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) Common operating systems discussed in this 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, branches offices, and company suppliers.

8 Course 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 casr letters.

13 UNIX Environment To view all environment variables, type printenv To view a particular environment variable, type echo $EDITOR The above command echos the value of the $EDITOR environment variable

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. On most UNIX-like systems, the /etc/passwd file provides an “X” in the password field that directs verification to the /etc/shadow file. 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 /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.login.

17 System Environment Variables TERM – is an environment variable defines the type of terminal being used. PATH – is an environment variable that contains the snip- it of directories to be searched for programs that correspond to command names. When a command name is entered to a shell, the PATH variable is searched sequentially through each directory until it finds an executable script or program with that command name typed. USER – contains the username. When a file or directories are accessed, the access permissions are verified against the value found in the USER variable. HOME – is an environment variable that contains your home directory.

18 HP-UX Executing Environment MAIL – is the environment variable that contains the name of the directory where your incoming mail is stored. EDITOR – is the environment variable used by programs that invoke text editors? 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.

19 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 send input to the child process, and receive output from it. When the child process finishes, all resources are relinquished to the system, your shell regains access to the terminal, redisplays the shell prompt, and waits for your next command.

20 Processes and Tasks Processes that requires user to be actively 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.

21 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.

22 Conceptual Appearance of UNIX

23 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)

24 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)

25 UNIX Operating System File Descriptor A process associates a number with each file it as 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.

26 UNIX Operating System Manual (man) Command Linux 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

27 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 *

28 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

29 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).

30 UNIX Operating System Redirection (cont) 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/Fall_2013_Solutions/foobar Append the standard output of a command to a file. cat foobar_2 >> foobar_1

31 Conceptual Appearance of UNIX 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)

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

33 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

34 Hands-On-Information Lab Assignment 2-1, Simple Shell Scripting, due January 20, 2014. Lab Assignment 3-1, Advanced Scripting, due January 27, 2014. 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.

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

36 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