Presentation is loading. Please wait.

Presentation is loading. Please wait.

Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming.

Similar presentations


Presentation on theme: "Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming."— Presentation transcript:

1

2 Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming Deadlines Lab assistance, questions, and chat time

3 Link of the week The link below lists most all operating systems that are available. http://dmoz.org/Computers/Software/Operating_Systems The link below has tabs for books, posters, software, and tools http://www.javvin.com/unix-like-poster.html Definition of Operating System (OS) is a multitasking, multi- user computer operating system that exists in many variants. The original Unix was developed at AT&T's Bell Labs research center by Ken Thompson, Dennis Ritchie, and others. Common operating systems discussed in class will be: UNIX, Linux, HP-UX, and Windows Basic tasks performed by an operating system ◦ Control and allocate memory for processes ◦ Prioritize system requests for the CPU ◦ Control input and output transmissions to and from devices ◦ Facilitate networking and support file system management

4 Link of the week Services Operating System (OS) perform ◦ Process management ◦ Memory management OS coordinates various types of memory ◦ File systems ◦ Networking ◦ Graphical user interface (GUI) and command line ◦ Device drivers ◦ Security  Internal management  External management

5 Link of the week Services Operating System (OS) perform Process management – Background and foreground processes Memory management - The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to the computer system. Random Access Memory (RAM) – Static and dynamic RAM. Cache Memory - is a cache used by the central processing unit of a computer to reduce the average time to access memory Shared Memory - The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and freeing it for reuse when no longer needed. This is critical to the computer system.

6 Link of the week File systems - Is an abstraction to store, retrieve and update a set of files. The term identifies data structures specified by some of those abstractions, which are designed to organize multiple files as a single stream of bytes. Network protocols are specified by other abstractions, which are designed to allow files on a system to be accessed remotely. Networking – Internal and external communication. Graphical user interface (GUI) and Command line (CLI). Device drivers - Is a computer program that operates or controls a particular type of device that is attached to a computer. A driver typically communicates with the device through the computer bus or communications subsystem to which the hardware connects.

7 Link of the week Security Internal management and external management. Internal security pertains to employees inside the company and visitors that come to a company to sale products, repair equipment and delivery persons. External security encompasses users needing access to company data and/or assets. The list of external users accessing data for a company could be significant depending on the nature of the business. The list includes employees working remotely, branch offices, and company suppliers.

8 This weeks expected outcome Upon successful completion of this module, the student will be able to: Create scripts using shell variables and program control flow. Use man page system and find script tools. Use redirection and pipes to combine scripts and executables.

9 VI Text Editor Features of the text editor “vi” Vi was the first full screen text editor written for UNIX. It was initially designed to be simple and small in size. The designers intended vi to fit on a floppy-based emergency boot system. For this specific reason, you may need to use it in an emergency recovery situation. Most Linux distributions ship with a variant of vi known as Vim. Vim has been enhanced, supporting more features than the original vi editor. You will find that most distributions of Vim support launching it by typing vi, as if it were the original vi.

10 VI Text Editor Vi is made up of three modes, executing in one of the three modes: The command mode accepts commands, which are usually single characters. For example, o and O and I and an all enter the insert mode, but in different ways. The O and o open a line above and below, respectively where the cursor is positioned. The Ex mode is entered for saving your file. This is initiated by typing a colon (:), followed by entering a w or q character to save or not to retain the information in the file. After executing in the ex-mode, vi automatically returns to the command mode. The Insert mode allows you to enter text that appears on the terminal. To exit the insert mode, depress the Esc key, which will return you to the command mode.

11 VI Text Editor Basic vi commands Save text file - :wq! Delete a character – x Inserts a new line immediately below the current line - o Inserts a new line immediately above the current line – O Undo any changes – u Change current word – cw Move around in file using the line number - G Insert information on left side of a character – i Insert information on right side of a character – a Delete a line in a file – dd

12 UNIX Environment Executing your environment The behavior of shell commands are determined by the execution of the environment provided by the shell. The UNIX shell maintains a complete set of environment variables that provide information about different areas of the operating system. For example, there are variables for the terminal type, current working directory, and default file and directory permissions. The environment variables are passed to all scripts and programs that are not built in to the shell, but may be accessed or modified, by the program. The convention for specifying environment variables is in upper case letters.

13 UNIX Environment To view all environment variables, type printenv To view a particular environment variable. echo $EDITOR The above statement outputs the value of the $EDITOR environment variable echo $TERM The above statement outputs the value of the $TERM environment variable. The TERM variable tells the shell what kind of terminal you are using.

14 HP-UX Executing Environment When you log in to a system, the sequence of events can differ when creating your working environment. The particular sequence of events depends on the flavor of UNIX being implemented and the default shell for your account. The HP-UX operating system subscribes to the following sequence of events at log in: The getty process provides the login: prompt seen on your terminal. The getty process reads the provided username, and invokes the login program.

15 HP-UX Executing Environment The login program receives the username from the getty process, and prompts the user for their password. The login program consults the /etc/passwd file to verify your password. The login program turns off terminal echo so that the password characters are not displayed on the terminal. After the password has been authenticated, the default shell is invoked by accessing the information in the last field of the /etc/passwd file for that username.

16 HP-UX Executing Environment When the shell program starts, it reads the configuration files called login scripts to configure the execution environment. On HP-UX, the /etc/profile file contains initialization parameters for ksh and sh, while the /etc/csh.login file is used for csh. After the system login scripts have been read, the shell looks for user- specific login scripts. After the system login scripts have been read, the shell reads user login scripts. The user login scripts are stored in the user’s home directory, where a user can customize their shell environment. The sh and ksh shells look in the.profile. Ksh reads a file defined in the environment variable ENV. Csh reads a file called.cshrc, and if it is the login shell, the file is named,.login.

17 System Environment Variables USER – contains the username. When a file or directories are accessed, the access permissions are verified against the value found in the USER variable. HOST – is an environment variable that contains the name of the host machine that is executing your shell program. When connecting to another remote machine through telnet or ftp, the name of the host is transferred to the remote machine, and displayed on the remote terminal so the administrator can know the names of the systems he or she is logged into.

18 Processes and Tasks General approach to foreground and background processes When you log in to a UNIX system, the kernel starts a specific shell for you, and connects your shell to your terminal. When a command is entered and executed from the shell, the shell creates a child process to execute the command, and connects the child process to your terminal. By connecting the child process to your terminal, the shell allows you to communicate sending input to the child process, and receiving output from it. When the child process finishes, all resources are relinquished (reaped) back to the system, your shell regains access to the terminal, redisplays the shell prompt, and waits for your next command.

19 Processes and Tasks Processes that require users to be active participants (like processing Excel) must execute in the foreground in order to run. These jobs are termed "interactive," and must periodically update the display monitor, and accept input from the user, and allow access to the terminal interface. There are processes that do not require active participation once they are started. For example, a subroutine that initially accepts input data like a pattern and data file from the main script, uses the pattern to find a match in the data file, and writes matched information to an output file. Non-interactive jobs do not accept input commands, display output data on your terminal, and are disconnected from your terminal, and releasing the terminal for interactive use. This type of process is referred to as a “background” process.

20 Processes and Tasks It is possible to log out of a system, and leave the background processes executing. The down side of this action is not being able to reconnect a background process to a terminal after logging out. If the background process identification information (PID) is known, the process can be terminated from a terminal. The number of background processes executing at the same time can be many, where a foreground process can only execute one process at a time. The reason is because you only have one terminal for viewing and one keyboard at your terminal.

21 Conceptual Appearance of UNIX

22 UNIX File Types Command: ls -l drwxrwxrwx permissions (Directory) -rwxrwxrwx permissions (File) lrwxrwxrwx permissions (Symbolic link) -rwx------ 2 dandrear faculty (Hard link) crw------- 1 root root audio (Character device) brw-rw---- 1 root disk aztcd (Block device)

23 UNIX Operating System Pipe Command Users can connect the standard output of one command into the standard input of another command by using the pipeline operator (|). Demonstrate command usage: ps -ef ps –ef | wc –l ps –ef | awk ‘{print $2}’ ps –ef | grep dandrear ls –l | cut –c1-3 who –b (Time of last system boot) who –r (Print current run level) who –s (Print short version of user on system)

24 UNIX Operating System File Descriptor A process associates a number with each file it has open. This number is called a file descriptor. When you log in, your first process has the following three open files connected to your terminal. Standard input: File descriptor 0 is open for reading. Standard output: File descriptor 1 is open for writing. Standard error: File descriptor 2 is open reading.

25 UNIX Operating System Manual (man) Command UNIX-like command documentation is known as “man”. Each page is a self-contained document. The Manual sections are split into eight numbered sections: 1 General commands. 2 System calls 3 C library functions 4 Special files (usually devices, those found in /dev) and drivers. 5 File formats and conventions 6 Games and screensavers 7 Miscellaneous 8 System administration commands and daemons

26 UNIX Operating System Grep Command The “grep” command searches the named input file(s) for lines in a file containing a given pattern. When a pattern is found, each line is reported to standard output. Demonstrate: grep [options] pattern file(s) grep inc_A ~dandrear/xyz grep inc_A prog1 prog2 grep inc_A *

27 UNIX Operating System Find Command The “find” command lists all pathnames that are in each of the given directories. Demonstrate: find ~dandrear –type d –print find ~dandrear –type f -print find. –print find / -type f –print

28 UNIX Operating System Redirections Many UNIX commands take text-like input and produce text-like output. It's sometimes useful to be able to control where the input comes from and output goes (via redirection), or even pass the output from one command to another's input (via pipes).

29 UNIX Operating System Redirection (cont’d) Redirect the standard output of a command to a file. date > /tmp/date_saved Redirect the standard input of a command so that it reads from a file instead of from your terminal. cat < ~dandrear/Winter_2015_Solutions/foobar Append the standard output of a command to a file. cat foobar_2 >> foobar_1

30 UNIX Operating System Moving Around in UNIX ls –a ps –ef whoami rmdir touch less w tail head sort man

31 Break-out Problems 1. More command 2. Program statement (#!/bin/ksh) 3. Less command 4. ps –ef | wc –l 5. who | awk ‘{print $1}’ | sort –u | wc –l 6. ps –ef | awk ‘{print $1}’ |sort –u | wc –l 7. find / ex 8. ps –ef | awk ‘{print $9, $1}’ 9. Shell language syntax: $# 10. Shell language command: for name in * 11. Shell language command: 12. NUMBER=$(($NUMBER - 1)) 13. Shell variable: PATH

32 Break-out Problems 1. ps | wc –l 2. who | awk ‘{print $1}‘ | sort –u | wc –l 3. ps –ef | awk ‘{print $1}’ | sort –u | wc –l 4. sort –r names.txt 5. ps –ef | awk ‘{print $8, $1}’ 6. find /bin -name gzip 7. find /etc -name motd 8. > newfile 9. rm file_name 10. date | cut –c 12-19 11. cp test_data.txt ~dandrea/temp 12. mv test_data.txt ~dandrear/temp 13. printf $NUMBER 14. touch newfile

33 Hands-On-Information Lab Assignment 2-1, Simple Shell Scripting, due January 25, 2015. Lab Assignment 3-1, Advanced Scripting, due Febuary 1, 2015. Read Chapters 1 and 2 in Essential System Administration text. Read Module Two listed under the course Web site. Everyone should have received a Shell Quick Reference document and script logic for Lab Assignment 2-1.

34 After Class Assistance Questions? Comments? Concerns? After each Franklin Live session, I will remain on the session to provide assistance unless otherwise indicated.

35 Lab assistance, questions, and chat time


Download ppt "Agenda Introduction Administrative Announcements Link of the Week Expected Outcomes This Week’s Topics Next Week’s Lab Assignment Break Out Problems Upcoming."

Similar presentations


Ads by Google