logging in or signing up basic unix presentaiton vin_taurus Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 641 Category: Education License: All Rights Reserved Like it (2) Dislike it (0) Added: August 10, 2010 This Presentation is Public Favorites: 1 Presentation Description Tutor presentation for Unix basics Comments Posting comment... By: sumit.khurana007 (8 month(s) ago) hii vinil u have done a gr8 job.can u please mail me this presentation of urs @ sumit.khurana007@gmail.com thanks. Saving..... Post Reply Close Saving..... Edit Comment Close By: vijaypogakula (10 month(s) ago) Hi Vinil, superb PPT. Plz send to my id vijaypogakula@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: vin_taurus (15 month(s) ago) hi all, I have mailed you the presentation to your mail id`s Saving..... Post Reply Close Saving..... Edit Comment Close By: malli016 (18 month(s) ago) will u pls send me this to malli.dammu@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: deeptikalra (20 month(s) ago) if possibl can you send me this on neetu1.kalra@yahoo.in Saving..... Post Reply Close Saving..... Edit Comment Close loading.... See all Premium member Presentation Transcript UNIX operating systemby Vinil Gopalkrishnan : UNIX operating systemby Vinil Gopalkrishnan 1 Operating system : Operating system An Operating System is the layer between the hardware and software An Operating System is responsible for the following functions: Device management using device drivers Process management using processes and threads Inter-process communication Memory management File systems 2 Operating system(cont).. : Operating system(cont).. In addition, all operating systems come with a set of standard utilities. The utilities allow common tasks to be performed such as: being able to start and stop processes being able to organize the set of available applications organize files into sets such as directories view files and sets of files edit files rename, copy, delete files communicate between processes 3 Introduction to UNIX operating system : Introduction to UNIX operating system 4 What is UNIX? : What is UNIX? History of UNIX Ken Thompson and Dennis Richie developed the first edition of Unix in 1969, which was used for text processing of patent documents. Fifth edition of Unix was released in 1973 and was written in C programming language, and from then on, Unix was become portable across different hardware platforms. History of Unix and other interesting facts are available form unix.org Philosophy of UNIX Unix is open source, flexible, scalable, portable, stable, secure and based on open standards. In Unix, programs are often designed to do one simple thing right. Unix provides ways for interconnecting these simple programs to work together and perform more complex tasks. Popularity of Unix systems only increased when Linus Torvalds created a Unix type operating system called Linux that can run on Intel® based personal computers. Today, while Microsoft® holds large share of PC operating systems, the Unix/Linux systems lead the server market. Linux costs less, and often are free. However, users still need to learn to adapt to the new environment. 5 Simplified UNIX Family Tree : Simplified UNIX Family Tree 6 Unix Interface : Unix Interface Interfaces Command Line interface is a simple text only interface. Users can type Unix commands, and the Unix shell reads and interprets these commands. Those who are used to GUI, working with command line interface may find a little daunting. However, once mastered, a command line interface is easy to use, flexible, and very powerful. If you want to get close to the operating system, command line interface is probably the best. A number of Graphical User Interfaces are also available, including IDEs. Types of UNIX There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X. 7 Unix architecture : Unix architecture The UNIX operating system is made up of three parts; the kernel, the shell and the programs. Kernel: The kernel of UNIX is the hub of the operating system it allocates time and memory to programs and handles the filestore and communications in response to system calls. An example of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt % to the user, indicating that it is waiting for further commands. 8 Unix architecture (cont) : Unix architecture (cont) Shell The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt (% on our systems). Shell Commands A shell command is usually in the following format: command options arguments Options are specified with a preceding - sign. Arguments can be any character strings. Example: ls -l mydir ls is the 'list' command to list files. The option -l, tells ls that, the files must be listed in long format. Mydir is the argument, which is the name of the folder to be listed. There can be multiple arguments for a command separated by spaces. ls -l mydir1 mydir2 The above command tells ls that files in both folders mydir1 and mydir2 must be listed 9 Unix architecture (cont) : Unix architecture (cont) Shell Categories Unix shells can be broadly divided into three categories: Bourne-like, C Shell-like and other shell. On most modern Unix-like systems the current shell is held in the $SHELL environmental variable. Bourne shell C shell Other shell 10 Vinil Gopalkrishnan Unix shell types : Unix shell types Bourne shell compatible The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. It remains a popular default shell for Unix accounts. The binary program of the Bourne shell or a compatible program is located at /bin/sh on most Unix systems, and is still the default shell for the root superuser on many current Unix implementations. Bourne shell (sh) -- Written by Steve Bourne, while at Bell Labs. First distributed with Version 7 Unix, circa 1978. Almquist shell (ash) -- Written as a BSD-licensed replacement for the Bourne Shell; often used in resource-constrained environments. The sh of FreeBSD, NetBSD (and their derivatives) are based on ash that has been enhanced to be POSIX conformant for the occasion. Bourne-Again shell (bash) -- Written as part of the GNU project to provide a superset of Bourne Shell functionality. Debian Almquist shell (dash) -- Dash is a modern replacement for ash in Debian and is expected to be the default /bin/sh for Debian Lenny. Korn shell (ksh) -- Written by David Korn, while at Bell Labs. Z shell (zsh) -- considered as the most complete (read: the most features) shell: it is the closest thing that exists to a superset of sh, ash, bash, csh, ksh, and tcsh 11 Unix shell types cont…. : Unix shell types cont…. C shell compatible The C shell has the typical Unix shell structure: each line of input (or line of a script file) is interpreted as a separate command to execute, with backslashes "escaping" newlines where needed (so that multiple input lines can comprise a single command to be executed). C shell (csh) Written by Bill Joy, while at the University of California, Berkeley. First distributed with BSD, circa 1979. TENEX C shell (tcsh) It is essentially the C shell with programmable command line completion, command-line editing, and a few other features. 12 Unix File System : Unix File System Other widely used shells fish, friendly interactive shell, first released in 2005. mudsh, an "intelligent" game-like shell that operates like a MUD. zoidberg, a modular Perl shell written, configured, and operated entirely in Perl. rc, the default shell on Plan 9 from Bell Labs and Version 10 Unix written by Tom Duff. Ports have been made to Inferno and Unix-like operating systems. es shell (es) A functional programming rc-compatible shell written in the mid-1990s. scsh (Scheme Shell) 13 Unix File System : Unix File System File Types Besides ordinary files, a directory is a special file in Unix. A symbolic link is a file that points to another file, much like a shortcut in Windows. In Unix devices are also accessible as files, which can be character devices or block devices. A block device transfers one block at a time, whereas a character device transfers one character at a time. Links Unix provides two kinds of links, namely, soft links and hard links. A soft link is a special file that contains the location of the original file. A hard link, on the other hand, is a directory entry that points to the "i-node" of the file. The term i-node stands for information node (or index node), which is essentially a block that contains information about a file including its physical location on disk. Each i-node contains a link count. When a file is created the link count is set to one. When a hard link is made, the link counts goes up by one. When a hard link is removed, the link count decreases by one. 14 Unix File System : inode : Unix File System : inode 15 Inode is a data structure used by Linux and Unix variants to store basic information of a file in the file system Command to list inode: df -hTi Unix File System (cont..) : Unix File System (cont..) Pipes A pipe is a mechanism for programs to communicate each other. A pipe in Unix is represented by '|' symbol. For example, for executing the command "ls | more", the program, ls generates output and the output is piped to the program "more", which displays the output on the screen one page at a time. The individual programs do not have to be designed anything differently for communicating each other. They receive input from standard input and generates output on the standard output. Files and processes Everything in UNIX is either a file or a process. A process is an executing program identified by a unique PID (process identifier). A file is a collection of data. They are created by users using text editors, running compilers etc. Examples of files: A document (report, essay etc.) , The text of a program written in some high-level programming language . Instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file); A directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files. 16 Unix Directory Structure : Unix Directory Structure All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root (written as a slash / ) In the diagram above, we see that the home directory of the undergraduate student "ee51vn" contains two sub-directories (docs and pics) and a file called report.doc. The full path to the file report.doc is "/home/its/ug1/ee51vn/report.doc" 17 Slide 18: Unix Commands 18 Unix Commands : Unix Commands A UNIX command line consists of the name of a UNIX command (actually the "command" is the name of a built-in shell command, a system utility or an application program) followed by its "arguments" (options and the target filenames and/or expressions). The general syntax for a UNIX command is $ command -options targets Here command can be though of as a verb, options as an adverb and targets as the direct objects of the verb. In the case that the user wishes to specify several options, these need not always be listed separately (the options can sometimes be listed altogether after a single dash). Note that Unix commands are case sensitive. To get help on using any of the commands, you may type man command-name 19 UNIX commands (Communicate with other users) : UNIX commands (Communicate with other users) 20 UNIX commands (Dealing with File system) : UNIX commands (Dealing with File system) 21 UNIX commands (Dealing with File system continued) : UNIX commands (Dealing with File system continued) 22 UNIX commands (Dealing with File system continued) : UNIX commands (Dealing with File system continued) 23 UNIX commands (Dealing with File system continued) : UNIX commands (Dealing with File system continued) 24 UNIX commands (working environment) : UNIX commands (working environment) 25 UNIX commands (controlling the jobs) : UNIX commands (controlling the jobs) 26 Metacharacters : Metacharacters 27 Command line editing : Command line editing 28 Command substitution : Command substitution We can use the output of one command as an input to another command in another way called command substitution. Command substitution is invoked when by enclosing the substituted command in backwards single quotes. For example: cat `find . -name aaa.txt` which will cat ( dump to the screen ) all the files named aaa.txt that exist in the current directory or in any subdirectory tree. 29 Tar command : Tar command Reading and writing tapes, backups, and archives: The tar command The tar command stands for "tape archive". It is the "standard" way to read and write archives (collections of files and whole directory trees). Often you will find archives of file with names like file.tar, or file.tar.gz. This is file in a tar archive, and file in a tar archive which has been compressed using the gzip compression program respectively. Chances are that if someone gives you a tape written on a UNIX system, it will be in tar format, and you will use tar (and your tape drive) to read it. Likewise, if you want to write a tape to give to someone else, you should probably use tar as well. 30 Tar command continued : Tar command continued Tar examples: tar xv Extracts (x) files from the default tape drive while listing (v = verbose) the file names to the screen. tar tv Lists the files from the default tape device without extracting them. tar cv file1 file2 Write files 'file1' and 'file2' to the default tape device. tar cvf archive.tar file1 [file2...] Create a tar archive as a file "archive.tar" containing file1, file2...etc. tar xvf archive.tar extract from the archive file tar cvfz archive.tar.gz dname Create a gzip compressed tar archive containing everything in the directory 'dname'. This does not work with all versions of tar. tar xvfz archive.tar.gz Extract a gzip compressed tar archive. Does not work with all versions of tar. tar cvfI archive.tar.bz2 dname Create a bz2 compressed tar archive. Does not work with all versions of tar 31 File compression : File compression The standard UNIX compression commands are compress and uncompress. Compressed files have a suffix .Z added to their name. For example: compress part.igs Creates a compressed file part.igs.Z uncompress part.igs Uncompresse is part.igs from the compressed file part.igs.Z Note the .Z is not required. Another common compression utility is gzip (and gunzip). These are the GNU compress and uncompress utilities. gzip usually gives better compression than standard compress, but may not be installed on all systems. The suffix for gzipped files is .gz gzip part.igs Creates a compressed file part.igs.gz gunzip part.igs Extracts the original file from part.igs.gz The bzip2 utility has (in general) even better compression than gzip, but at the cost of longer times to compress and uncompress the files. It is not as common a utility as gzip, but is becoming more generally available. bzip2 part.igs Create a compressed Iges file part.igs.bz2 bunzip2 part.igs.bz2 Uncompress the compressed iges file. 32 Online help : Online help The man command displays information from the UNIX manual set. Use the command man man to see the options available on your system. Navigating through the man command output: space move down a page ENTER move down a line b move back a page q quit man command usage: man [options] subject subject is the name of a command, function, subroutine, etc. Example: man passwd gives information about the passwd command. The manual pages have a facility similar to a book index which can be used to find the name of a UNIX command or all references to a particular subject. Syntax: man -k subject 33 UNIX APPLICATIONSElectronic Mail Text Editing Information Retrieval USENET News groups telnet/ftp : UNIX APPLICATIONSElectronic Mail Text Editing Information Retrieval USENET News groups telnet/ftp 34 Electronic Mail : Electronic Mail Electronic Mail Basic e-mail services are built into UNIX The mail command can be used to send/read e-mail. (See the manual pages for mail for more information.) Note: The mail user interface is rather primitive and not user friendly. Electronic Mail: Pine Its recommended using pine (Program for Internet News and Email) Full featured, including the pico text editor and a built-in newsreader. User friendly (and user configurable) interface Built-in on-line help facility Note: pine is not built into UNIX, but is available for free. 35 Text Editing : Text Editing The built-in full-screen editor in UNIX is vi Other common editors on UNIX systems emacs jove xedit pico (the default editor in pine, but can also be used separately for editing text ) DOS and MS-Windows versions of pico are also available 36 vi editor : vi editor Opening a file vi filename Creating text Edit modes: These keys enter editing modes and type in the text of your document. i Insert before current cursor position I Insert at beginning of current line a Insert (append) after current cursor position A Append to end of line r Replace 1 character R Replace mode <ESC> Terminate insertion or overwrite mode Deletion of text x Delete single character dd Delete current line and put in buffer ndd Delete n lines (n is a number) and put them in buffer J Attaches the next line to the end of the current line (deletes carriage return). u Undo last command 37 vi editor continued : vi editor continued cut and paste yy Yank current line into buffer nyy Yank n lines into buffer p Put the contents of the buffer after the current line P Put the contents of the buffer before the current line cursor positioning ^d Page down ^u Page up :n Position cursor at line n :$ Position cursor at end of file ^g Display current line number h,j,k,l Left,Down,Up, and Right respectivly. string substitution :n1,n2:s/string1/string2/[g] Substitute string2 for string1 on lines n1 to n2. If g is included (meaning global), all instances of string1 on each line are substituted. If g is not included, only the first instance per matching line is substituted. ^ matches start of line . matches any single character $ matches end of line 38 vi editor continued : vi editor continued Saving and quitting and other "ex" commands These commands are all prefixed by pressing colon (:) and then entered in the lower left corner of the window. They are called "ex" commands because they are commands of the ex text editor - the precursor line editor to the screen editor vi. You cannot enter an "ex" command when you are in an edit mode (typing text onto the screen) Press <ESC> to exit from an editing mode. :w Write the current file. :w new.file Write the file to the name 'new.file'. :w! existing.file Overwrite an existing file with the file currently being edited. :wq Write the file and quit. :q Quit. :q! Quit with no changes. :e filename Open the file 'filename' for editing. :set number Turns on line numbering :set nonumber Turns off line numbering 39 pico text editor : pico text editor pico command summary ^G Display the on-line help. ^F move Forward a character. ^B move Backward a character. ^P move to the Previous line. ^N move to the Next line. ^A move to the beginning of the current line. ^E move to the End of the current line. ^V move forward a page of text. ^Y move backward a page of text. ^W Search for (where is) text, neglecting case. ^L Refresh the display. ^D Delete the character at the cursor position. ^^ Mark cursor position as beginning of selected text. ^K Cut selected text (displayed in inverse characters). ^U Uncut (paste) last cut text inserting it at the current cursor position. ^I Insert a tab at the current cursor position. ^J Format (justify) the current paragraph. ^T To invoke the spelling checker. ^C Report current cursor position. ^R Insert an external file at the current cursor position. ^O Output the current buffer to a file, saving it. ^X Exit pico, saving buffer. 40 Information retrieval / Navigating the internet : Information retrieval / Navigating the internet Text-based utilities USENET news telnet/ftp X-Windows-based utilities EFF's USENET News Hierarchies bionet Research biology comp Computers and related subjects news News about USENET rec Hobbies, games and recreation sci Science other than research biology soc "Social" groups, often ethnically related alt Controversial or unusual topics; not carried by all sites uga University of Georgia local groups clari Clarinet news feed 41 Other internet utilities : Other internet utilities telnet Used to connect to remote computers You need an account on the remote machine tn3270 Used to connect to IBM mainframes ftp Used to transfer files from a remote computer Anonymous ftp is available at many sites 42 Unix-AIX : Unix-AIX 43 Introduction to AIX : Introduction to AIX AIX (Advanced Interactive eXecutive) is the name given to a series of proprietary operating systems sold by IBM for several of its computer system platforms, based on UNIX System V with 4.3BSD-compatible command and programming interface extensions. AIX was first entered into the market by IBM in February 1990. AIX is an implementation of Unix derived from both AT&T Unix System V and 4.3 BSD. AIX offers the Korn (ksh) shell, Bourne (sh) and C (csh) shells however defaults to the Korn shell. AIX primarily designed for medium to large scale servers and mainframes. However, can also be used in workstations. 44 Strengths of AIX : Strengths of AIX System Management Interface Tools smit and smitty. These are very good system admin tools and cover 95% of your admin work. If you want to learn AIX command line interfaces, just hit F6 and smitty will tell you what commands it will use. The IBM compilers for AIX are very good but fussy about your code. Other compilers may let you get away with ambiguous code and make assumptions, but IBM compilers will issue warning messages where your code (for example) relies on side effects or ordering that is not defined in the C standards. Built in Logical Volume Manager (LVM) - AIX was developed from day one assuming large systems and lots of disks and so has an LVM to manage groups of disks. Some of the terms used may be different than those of other UNIX versions but the LVM is flexible, powerful, and easy to use. LVM is delivered with base AIX. AIX has a Journaling Filesystem (JFS2) which supports multi-TB filesystems. The older JFS filesystem is still available, too. Both are delivered with base AIX. Workload Manager (WLM) allows multiple applications to be segregated into classes and resources (CPU time, memory, and disk I/O) assigned to the classes, which allows coexistence, monitoring, and management of multiple workloads on a single OS image. (Think Solaris Containers.) WLM is delivered with base AIX. 45 Strengths of AIX continued : Strengths of AIX continued HACMP - High Availability Cluster Multiprocessing allows AIX to run a cluster of machines with automated take-over and/or fail-over of applications and data between machines. Reliability, Availability and Serviceability (RAS) - marketing speak for a) things don't break often, b) if something breaks, the machine usually either keeps running or comes back up immediately after crashing with the failing component offline, and c) the machine is usually able to identify the failing component and the failing component can often be replaced while the machine continues to run. RAS is built in to AIX and the underlying hardware Logical Partitions (LPARs) - machines with POWER4 and POWER5 CPUs can be partitioned to run multiple copies of AIX (and/or Linux) at the same time. Workloads formerly run on multiple machines can be run on a single machine, allowing hardware resources to be dynamically (without reboot when running AIX V5.2, V5.3, or Linux) moved as workloads fluctuate. If workloads mesh well (encounter peak loads at different times of the day, week, month, or year), workloads consolidated onto a single machine can be run with fewer resources than required to run them on multiple separate machines, thereby reducing cost. Micro-partitioning - LPARs can share CPUs, which the Hypervisor time-slices. (Requires AIX V5.3 or the Linux 2.6 kernel.) Virtualization - LPARs can share disks (and disk & network adapters) to reduce costs. (Requires AIX V5.3 or the Linux 2.6 kernel.) 46 Logging out etc : Logging out etc logout Exits from the current interactive shell NB in a windowing environment, this will only log out one of your windows. exit Exits from the current shell Similar to logout, but can also be used in shell scripts. 47 Questions : Questions 48 Thanks : Thanks 49 You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
basic unix presentaiton vin_taurus Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT lite Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 641 Category: Education License: All Rights Reserved Like it (2) Dislike it (0) Added: August 10, 2010 This Presentation is Public Favorites: 1 Presentation Description Tutor presentation for Unix basics Comments Posting comment... By: sumit.khurana007 (8 month(s) ago) hii vinil u have done a gr8 job.can u please mail me this presentation of urs @ sumit.khurana007@gmail.com thanks. Saving..... Post Reply Close Saving..... Edit Comment Close By: vijaypogakula (10 month(s) ago) Hi Vinil, superb PPT. Plz send to my id vijaypogakula@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: vin_taurus (15 month(s) ago) hi all, I have mailed you the presentation to your mail id`s Saving..... Post Reply Close Saving..... Edit Comment Close By: malli016 (18 month(s) ago) will u pls send me this to malli.dammu@gmail.com Saving..... Post Reply Close Saving..... Edit Comment Close By: deeptikalra (20 month(s) ago) if possibl can you send me this on neetu1.kalra@yahoo.in Saving..... Post Reply Close Saving..... Edit Comment Close loading.... See all Premium member Presentation Transcript UNIX operating systemby Vinil Gopalkrishnan : UNIX operating systemby Vinil Gopalkrishnan 1 Operating system : Operating system An Operating System is the layer between the hardware and software An Operating System is responsible for the following functions: Device management using device drivers Process management using processes and threads Inter-process communication Memory management File systems 2 Operating system(cont).. : Operating system(cont).. In addition, all operating systems come with a set of standard utilities. The utilities allow common tasks to be performed such as: being able to start and stop processes being able to organize the set of available applications organize files into sets such as directories view files and sets of files edit files rename, copy, delete files communicate between processes 3 Introduction to UNIX operating system : Introduction to UNIX operating system 4 What is UNIX? : What is UNIX? History of UNIX Ken Thompson and Dennis Richie developed the first edition of Unix in 1969, which was used for text processing of patent documents. Fifth edition of Unix was released in 1973 and was written in C programming language, and from then on, Unix was become portable across different hardware platforms. History of Unix and other interesting facts are available form unix.org Philosophy of UNIX Unix is open source, flexible, scalable, portable, stable, secure and based on open standards. In Unix, programs are often designed to do one simple thing right. Unix provides ways for interconnecting these simple programs to work together and perform more complex tasks. Popularity of Unix systems only increased when Linus Torvalds created a Unix type operating system called Linux that can run on Intel® based personal computers. Today, while Microsoft® holds large share of PC operating systems, the Unix/Linux systems lead the server market. Linux costs less, and often are free. However, users still need to learn to adapt to the new environment. 5 Simplified UNIX Family Tree : Simplified UNIX Family Tree 6 Unix Interface : Unix Interface Interfaces Command Line interface is a simple text only interface. Users can type Unix commands, and the Unix shell reads and interprets these commands. Those who are used to GUI, working with command line interface may find a little daunting. However, once mastered, a command line interface is easy to use, flexible, and very powerful. If you want to get close to the operating system, command line interface is probably the best. A number of Graphical User Interfaces are also available, including IDEs. Types of UNIX There are many different versions of UNIX, although they share common similarities. The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X. 7 Unix architecture : Unix architecture The UNIX operating system is made up of three parts; the kernel, the shell and the programs. Kernel: The kernel of UNIX is the hub of the operating system it allocates time and memory to programs and handles the filestore and communications in response to system calls. An example of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt % to the user, indicating that it is waiting for further commands. 8 Unix architecture (cont) : Unix architecture (cont) Shell The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt (% on our systems). Shell Commands A shell command is usually in the following format: command options arguments Options are specified with a preceding - sign. Arguments can be any character strings. Example: ls -l mydir ls is the 'list' command to list files. The option -l, tells ls that, the files must be listed in long format. Mydir is the argument, which is the name of the folder to be listed. There can be multiple arguments for a command separated by spaces. ls -l mydir1 mydir2 The above command tells ls that files in both folders mydir1 and mydir2 must be listed 9 Unix architecture (cont) : Unix architecture (cont) Shell Categories Unix shells can be broadly divided into three categories: Bourne-like, C Shell-like and other shell. On most modern Unix-like systems the current shell is held in the $SHELL environmental variable. Bourne shell C shell Other shell 10 Vinil Gopalkrishnan Unix shell types : Unix shell types Bourne shell compatible The Bourne shell, or sh, was the default Unix shell of Unix Version 7, and replaced the Thompson shell, whose executable file had the same name, sh. It remains a popular default shell for Unix accounts. The binary program of the Bourne shell or a compatible program is located at /bin/sh on most Unix systems, and is still the default shell for the root superuser on many current Unix implementations. Bourne shell (sh) -- Written by Steve Bourne, while at Bell Labs. First distributed with Version 7 Unix, circa 1978. Almquist shell (ash) -- Written as a BSD-licensed replacement for the Bourne Shell; often used in resource-constrained environments. The sh of FreeBSD, NetBSD (and their derivatives) are based on ash that has been enhanced to be POSIX conformant for the occasion. Bourne-Again shell (bash) -- Written as part of the GNU project to provide a superset of Bourne Shell functionality. Debian Almquist shell (dash) -- Dash is a modern replacement for ash in Debian and is expected to be the default /bin/sh for Debian Lenny. Korn shell (ksh) -- Written by David Korn, while at Bell Labs. Z shell (zsh) -- considered as the most complete (read: the most features) shell: it is the closest thing that exists to a superset of sh, ash, bash, csh, ksh, and tcsh 11 Unix shell types cont…. : Unix shell types cont…. C shell compatible The C shell has the typical Unix shell structure: each line of input (or line of a script file) is interpreted as a separate command to execute, with backslashes "escaping" newlines where needed (so that multiple input lines can comprise a single command to be executed). C shell (csh) Written by Bill Joy, while at the University of California, Berkeley. First distributed with BSD, circa 1979. TENEX C shell (tcsh) It is essentially the C shell with programmable command line completion, command-line editing, and a few other features. 12 Unix File System : Unix File System Other widely used shells fish, friendly interactive shell, first released in 2005. mudsh, an "intelligent" game-like shell that operates like a MUD. zoidberg, a modular Perl shell written, configured, and operated entirely in Perl. rc, the default shell on Plan 9 from Bell Labs and Version 10 Unix written by Tom Duff. Ports have been made to Inferno and Unix-like operating systems. es shell (es) A functional programming rc-compatible shell written in the mid-1990s. scsh (Scheme Shell) 13 Unix File System : Unix File System File Types Besides ordinary files, a directory is a special file in Unix. A symbolic link is a file that points to another file, much like a shortcut in Windows. In Unix devices are also accessible as files, which can be character devices or block devices. A block device transfers one block at a time, whereas a character device transfers one character at a time. Links Unix provides two kinds of links, namely, soft links and hard links. A soft link is a special file that contains the location of the original file. A hard link, on the other hand, is a directory entry that points to the "i-node" of the file. The term i-node stands for information node (or index node), which is essentially a block that contains information about a file including its physical location on disk. Each i-node contains a link count. When a file is created the link count is set to one. When a hard link is made, the link counts goes up by one. When a hard link is removed, the link count decreases by one. 14 Unix File System : inode : Unix File System : inode 15 Inode is a data structure used by Linux and Unix variants to store basic information of a file in the file system Command to list inode: df -hTi Unix File System (cont..) : Unix File System (cont..) Pipes A pipe is a mechanism for programs to communicate each other. A pipe in Unix is represented by '|' symbol. For example, for executing the command "ls | more", the program, ls generates output and the output is piped to the program "more", which displays the output on the screen one page at a time. The individual programs do not have to be designed anything differently for communicating each other. They receive input from standard input and generates output on the standard output. Files and processes Everything in UNIX is either a file or a process. A process is an executing program identified by a unique PID (process identifier). A file is a collection of data. They are created by users using text editors, running compilers etc. Examples of files: A document (report, essay etc.) , The text of a program written in some high-level programming language . Instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file); A directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files. 16 Unix Directory Structure : Unix Directory Structure All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root (written as a slash / ) In the diagram above, we see that the home directory of the undergraduate student "ee51vn" contains two sub-directories (docs and pics) and a file called report.doc. The full path to the file report.doc is "/home/its/ug1/ee51vn/report.doc" 17 Slide 18: Unix Commands 18 Unix Commands : Unix Commands A UNIX command line consists of the name of a UNIX command (actually the "command" is the name of a built-in shell command, a system utility or an application program) followed by its "arguments" (options and the target filenames and/or expressions). The general syntax for a UNIX command is $ command -options targets Here command can be though of as a verb, options as an adverb and targets as the direct objects of the verb. In the case that the user wishes to specify several options, these need not always be listed separately (the options can sometimes be listed altogether after a single dash). Note that Unix commands are case sensitive. To get help on using any of the commands, you may type man command-name 19 UNIX commands (Communicate with other users) : UNIX commands (Communicate with other users) 20 UNIX commands (Dealing with File system) : UNIX commands (Dealing with File system) 21 UNIX commands (Dealing with File system continued) : UNIX commands (Dealing with File system continued) 22 UNIX commands (Dealing with File system continued) : UNIX commands (Dealing with File system continued) 23 UNIX commands (Dealing with File system continued) : UNIX commands (Dealing with File system continued) 24 UNIX commands (working environment) : UNIX commands (working environment) 25 UNIX commands (controlling the jobs) : UNIX commands (controlling the jobs) 26 Metacharacters : Metacharacters 27 Command line editing : Command line editing 28 Command substitution : Command substitution We can use the output of one command as an input to another command in another way called command substitution. Command substitution is invoked when by enclosing the substituted command in backwards single quotes. For example: cat `find . -name aaa.txt` which will cat ( dump to the screen ) all the files named aaa.txt that exist in the current directory or in any subdirectory tree. 29 Tar command : Tar command Reading and writing tapes, backups, and archives: The tar command The tar command stands for "tape archive". It is the "standard" way to read and write archives (collections of files and whole directory trees). Often you will find archives of file with names like file.tar, or file.tar.gz. This is file in a tar archive, and file in a tar archive which has been compressed using the gzip compression program respectively. Chances are that if someone gives you a tape written on a UNIX system, it will be in tar format, and you will use tar (and your tape drive) to read it. Likewise, if you want to write a tape to give to someone else, you should probably use tar as well. 30 Tar command continued : Tar command continued Tar examples: tar xv Extracts (x) files from the default tape drive while listing (v = verbose) the file names to the screen. tar tv Lists the files from the default tape device without extracting them. tar cv file1 file2 Write files 'file1' and 'file2' to the default tape device. tar cvf archive.tar file1 [file2...] Create a tar archive as a file "archive.tar" containing file1, file2...etc. tar xvf archive.tar extract from the archive file tar cvfz archive.tar.gz dname Create a gzip compressed tar archive containing everything in the directory 'dname'. This does not work with all versions of tar. tar xvfz archive.tar.gz Extract a gzip compressed tar archive. Does not work with all versions of tar. tar cvfI archive.tar.bz2 dname Create a bz2 compressed tar archive. Does not work with all versions of tar 31 File compression : File compression The standard UNIX compression commands are compress and uncompress. Compressed files have a suffix .Z added to their name. For example: compress part.igs Creates a compressed file part.igs.Z uncompress part.igs Uncompresse is part.igs from the compressed file part.igs.Z Note the .Z is not required. Another common compression utility is gzip (and gunzip). These are the GNU compress and uncompress utilities. gzip usually gives better compression than standard compress, but may not be installed on all systems. The suffix for gzipped files is .gz gzip part.igs Creates a compressed file part.igs.gz gunzip part.igs Extracts the original file from part.igs.gz The bzip2 utility has (in general) even better compression than gzip, but at the cost of longer times to compress and uncompress the files. It is not as common a utility as gzip, but is becoming more generally available. bzip2 part.igs Create a compressed Iges file part.igs.bz2 bunzip2 part.igs.bz2 Uncompress the compressed iges file. 32 Online help : Online help The man command displays information from the UNIX manual set. Use the command man man to see the options available on your system. Navigating through the man command output: space move down a page ENTER move down a line b move back a page q quit man command usage: man [options] subject subject is the name of a command, function, subroutine, etc. Example: man passwd gives information about the passwd command. The manual pages have a facility similar to a book index which can be used to find the name of a UNIX command or all references to a particular subject. Syntax: man -k subject 33 UNIX APPLICATIONSElectronic Mail Text Editing Information Retrieval USENET News groups telnet/ftp : UNIX APPLICATIONSElectronic Mail Text Editing Information Retrieval USENET News groups telnet/ftp 34 Electronic Mail : Electronic Mail Electronic Mail Basic e-mail services are built into UNIX The mail command can be used to send/read e-mail. (See the manual pages for mail for more information.) Note: The mail user interface is rather primitive and not user friendly. Electronic Mail: Pine Its recommended using pine (Program for Internet News and Email) Full featured, including the pico text editor and a built-in newsreader. User friendly (and user configurable) interface Built-in on-line help facility Note: pine is not built into UNIX, but is available for free. 35 Text Editing : Text Editing The built-in full-screen editor in UNIX is vi Other common editors on UNIX systems emacs jove xedit pico (the default editor in pine, but can also be used separately for editing text ) DOS and MS-Windows versions of pico are also available 36 vi editor : vi editor Opening a file vi filename Creating text Edit modes: These keys enter editing modes and type in the text of your document. i Insert before current cursor position I Insert at beginning of current line a Insert (append) after current cursor position A Append to end of line r Replace 1 character R Replace mode <ESC> Terminate insertion or overwrite mode Deletion of text x Delete single character dd Delete current line and put in buffer ndd Delete n lines (n is a number) and put them in buffer J Attaches the next line to the end of the current line (deletes carriage return). u Undo last command 37 vi editor continued : vi editor continued cut and paste yy Yank current line into buffer nyy Yank n lines into buffer p Put the contents of the buffer after the current line P Put the contents of the buffer before the current line cursor positioning ^d Page down ^u Page up :n Position cursor at line n :$ Position cursor at end of file ^g Display current line number h,j,k,l Left,Down,Up, and Right respectivly. string substitution :n1,n2:s/string1/string2/[g] Substitute string2 for string1 on lines n1 to n2. If g is included (meaning global), all instances of string1 on each line are substituted. If g is not included, only the first instance per matching line is substituted. ^ matches start of line . matches any single character $ matches end of line 38 vi editor continued : vi editor continued Saving and quitting and other "ex" commands These commands are all prefixed by pressing colon (:) and then entered in the lower left corner of the window. They are called "ex" commands because they are commands of the ex text editor - the precursor line editor to the screen editor vi. You cannot enter an "ex" command when you are in an edit mode (typing text onto the screen) Press <ESC> to exit from an editing mode. :w Write the current file. :w new.file Write the file to the name 'new.file'. :w! existing.file Overwrite an existing file with the file currently being edited. :wq Write the file and quit. :q Quit. :q! Quit with no changes. :e filename Open the file 'filename' for editing. :set number Turns on line numbering :set nonumber Turns off line numbering 39 pico text editor : pico text editor pico command summary ^G Display the on-line help. ^F move Forward a character. ^B move Backward a character. ^P move to the Previous line. ^N move to the Next line. ^A move to the beginning of the current line. ^E move to the End of the current line. ^V move forward a page of text. ^Y move backward a page of text. ^W Search for (where is) text, neglecting case. ^L Refresh the display. ^D Delete the character at the cursor position. ^^ Mark cursor position as beginning of selected text. ^K Cut selected text (displayed in inverse characters). ^U Uncut (paste) last cut text inserting it at the current cursor position. ^I Insert a tab at the current cursor position. ^J Format (justify) the current paragraph. ^T To invoke the spelling checker. ^C Report current cursor position. ^R Insert an external file at the current cursor position. ^O Output the current buffer to a file, saving it. ^X Exit pico, saving buffer. 40 Information retrieval / Navigating the internet : Information retrieval / Navigating the internet Text-based utilities USENET news telnet/ftp X-Windows-based utilities EFF's USENET News Hierarchies bionet Research biology comp Computers and related subjects news News about USENET rec Hobbies, games and recreation sci Science other than research biology soc "Social" groups, often ethnically related alt Controversial or unusual topics; not carried by all sites uga University of Georgia local groups clari Clarinet news feed 41 Other internet utilities : Other internet utilities telnet Used to connect to remote computers You need an account on the remote machine tn3270 Used to connect to IBM mainframes ftp Used to transfer files from a remote computer Anonymous ftp is available at many sites 42 Unix-AIX : Unix-AIX 43 Introduction to AIX : Introduction to AIX AIX (Advanced Interactive eXecutive) is the name given to a series of proprietary operating systems sold by IBM for several of its computer system platforms, based on UNIX System V with 4.3BSD-compatible command and programming interface extensions. AIX was first entered into the market by IBM in February 1990. AIX is an implementation of Unix derived from both AT&T Unix System V and 4.3 BSD. AIX offers the Korn (ksh) shell, Bourne (sh) and C (csh) shells however defaults to the Korn shell. AIX primarily designed for medium to large scale servers and mainframes. However, can also be used in workstations. 44 Strengths of AIX : Strengths of AIX System Management Interface Tools smit and smitty. These are very good system admin tools and cover 95% of your admin work. If you want to learn AIX command line interfaces, just hit F6 and smitty will tell you what commands it will use. The IBM compilers for AIX are very good but fussy about your code. Other compilers may let you get away with ambiguous code and make assumptions, but IBM compilers will issue warning messages where your code (for example) relies on side effects or ordering that is not defined in the C standards. Built in Logical Volume Manager (LVM) - AIX was developed from day one assuming large systems and lots of disks and so has an LVM to manage groups of disks. Some of the terms used may be different than those of other UNIX versions but the LVM is flexible, powerful, and easy to use. LVM is delivered with base AIX. AIX has a Journaling Filesystem (JFS2) which supports multi-TB filesystems. The older JFS filesystem is still available, too. Both are delivered with base AIX. Workload Manager (WLM) allows multiple applications to be segregated into classes and resources (CPU time, memory, and disk I/O) assigned to the classes, which allows coexistence, monitoring, and management of multiple workloads on a single OS image. (Think Solaris Containers.) WLM is delivered with base AIX. 45 Strengths of AIX continued : Strengths of AIX continued HACMP - High Availability Cluster Multiprocessing allows AIX to run a cluster of machines with automated take-over and/or fail-over of applications and data between machines. Reliability, Availability and Serviceability (RAS) - marketing speak for a) things don't break often, b) if something breaks, the machine usually either keeps running or comes back up immediately after crashing with the failing component offline, and c) the machine is usually able to identify the failing component and the failing component can often be replaced while the machine continues to run. RAS is built in to AIX and the underlying hardware Logical Partitions (LPARs) - machines with POWER4 and POWER5 CPUs can be partitioned to run multiple copies of AIX (and/or Linux) at the same time. Workloads formerly run on multiple machines can be run on a single machine, allowing hardware resources to be dynamically (without reboot when running AIX V5.2, V5.3, or Linux) moved as workloads fluctuate. If workloads mesh well (encounter peak loads at different times of the day, week, month, or year), workloads consolidated onto a single machine can be run with fewer resources than required to run them on multiple separate machines, thereby reducing cost. Micro-partitioning - LPARs can share CPUs, which the Hypervisor time-slices. (Requires AIX V5.3 or the Linux 2.6 kernel.) Virtualization - LPARs can share disks (and disk & network adapters) to reduce costs. (Requires AIX V5.3 or the Linux 2.6 kernel.) 46 Logging out etc : Logging out etc logout Exits from the current interactive shell NB in a windowing environment, this will only log out one of your windows. exit Exits from the current shell Similar to logout, but can also be used in shell scripts. 47 Questions : Questions 48 Thanks : Thanks 49