280 likes | 421 Views
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. Agenda. The link below lists most all operating systems that are available.
E N D
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 Agenda
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 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 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. 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 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. Link of the week
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. Course expected outcome
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. 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. 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 - <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 VI Text Editor
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. 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 UNIX 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. 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. 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. HP-UX Executing Environment
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. System Environment Variables
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. HP-UX Executing Environment
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 back to the system, your shell regains access to the terminal, redisplays the shell prompt, and waits for your next command. 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. 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. Processes and Tasks
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) UNIX File Types
Moving Around in UNIX ls–a ps–ef whoami rmdir touch less w tail head sort man UNIX Operating System
ps | wc –l • who | awk ‘{print $1}‘ | sort –u | wc –l • ps –ef | awk ‘{print $1}’ | sort –u | wc –l • sort –r names.txt • ps –ef | awk ‘{print $8, $1}’ • find /bin -name gzip • find /etc -name motd • > newfile • rmfile_name • date | cut –c 12-19 • cp test_data.txt ~dandrea/temp • mv test_data.txt ~dandrear/temp • printf $NUMBER • touch newfile Break-out Problems
Lab Assignment 2-1, Simple Shell Scripting, due May 18, 2014. • Lab Assignment 3-1, Advanced Scripting, due May 25, 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. Hands-On-Information
Questions? Comments? Concerns? After each Franklin Live session, I will remain on the session to provide assistance unless otherwise indicated. After Class Assistance