3.
Development of UNIX and Linux <ul><li>UNIX os, developed in 1970s at Bell Laboratories, features: </li></ul><ul><ul><ul><li>main program, called kernel , to control CPU and other hardware. </li></ul></ul></ul><ul><ul><ul><li>collection of user and system programs called utilities . </li></ul></ul></ul><ul><ul><ul><li>structure, called file system , for keeping and locating data on hard drive. </li></ul></ul></ul><ul><ul><ul><li>Unix was a multi-user and multi-tasking os </li></ul></ul></ul>

4.
Development of UNIX and Linux <ul><li>Linus Torvalds wrote a UNIX look-alike operating system called Linux . </li></ul><ul><li>The operating system is available for free in its basic form for download, or at a low cost from several distributors. </li></ul>

5.
<ul><li>fundamental programs in Linux employ same code , but different distributors add special features and installation programs. </li></ul><ul><li>Some of different flavors of Linux operating system are RedHat, Lindows, SuSe, Mandrake, etc. </li></ul>Development of UNIX and Linux

6.
Commands to Execute Utilities <ul><li>Introduction to the shell. </li></ul><ul><li>Issuing commands to a shell. </li></ul><ul><li>Passing information to a utility. </li></ul><ul><li>Listing processes. </li></ul>

7.
Introduction to the Shell <ul><li>shell: program which displays prompt on screen. </li></ul><ul><li>shell reads instructions of user and interprets them to the remainder of the system. </li></ul><ul><li>Usually $ sign is the prompt in many systems. </li></ul><ul><li>shell processes and executes command keyed in by user. </li></ul>

8.
Issuing Commands to a Shell <ul><li>Various utilities can be executed from the shell prompt. </li></ul><ul><li>“ whoami ” utility displays user’s login name or username on screen. </li></ul><ul><li>“ date ” utility displays current date and time on screen. </li></ul><ul><li>“ hostname ” utility display name of system user working on. </li></ul>

9.
Issuing Commands to a Shell <ul><li>“ clear ” utility to clear all text on screen and display the prompt at top of screen or window. </li></ul><ul><li>Delete or Ctrl-H to correct errors that occur while entering commands. </li></ul><ul><li>“ who ” utility to display list of users currently logged on. </li></ul>

11.
Issuing Commands to a Shell <ul><li>port: physical location at back of computer. </li></ul><ul><li>Each port has designation- usually begins with tty and number </li></ul><ul><li>terminal connected through network uses electronic or pseudo port named pts . </li></ul>

12.
Issuing Commands to a Shell <ul><li>command/utility keyed in by a user is followed by the ENTER key. </li></ul><ul><li>shell interprets ENTER as end of command/utility. </li></ul><ul><li>shell starts child process to execute command/utility. </li></ul>

15.
Passing Information to a Utility <ul><li>When information passed to a utility, shell runs utility, and passes information that comes after the command to utility. </li></ul><ul><li>Information passed to utility called argument . </li></ul><ul><li>Arguments provide instructions to utilities. </li></ul><ul><li>Multiple arguments can also be passed to a utility. </li></ul>

16.
Passing Information to a Utility <ul><li>“ cal ” program provides users current month’s calendar. </li></ul><ul><li>Multiple arguments can be passed to cal utility. </li></ul><ul><li>When two arguments are passed to cal program, the program interprets first argument as month and second as year. </li></ul>

17.
Passing Information to a Utility <ul><li>“ look ” command to locate words in dictionary file that begin with that word, and output all matching words. </li></ul><ul><li>look command requires one argument – word to locate. </li></ul>

18.
Listing Processes <ul><li>A process is an instance of a running program code. </li></ul><ul><li>“ ps ” command to list all current processes, with some info about each process. </li></ul><ul><li>output displays process id , port , CPU time , and code process is running. </li></ul>

20.
Communicating Instructions to the Shell <ul><li>Every user is given a place, called home directory , to work with and save files. </li></ul><ul><li>home directory: default workspace of user. </li></ul><ul><li>home directory contains names of files and subdirectories created by and owned by a user. </li></ul>

21.
Communicating Instructions to the Shell <ul><li>Working with files. </li></ul><ul><li>Redirecting output from a utility. </li></ul><ul><li>Determining the role of tokens on command-lines. </li></ul><ul><li>Starting a child shell. </li></ul><ul><li>Reissuing commands. </li></ul><ul><li>Using nicknames for commands. </li></ul>

22.
Working with Files <ul><li>“ ls ” (list) command lists contents of current directory’s standard files. </li></ul><ul><li>“ more ” command displays contents of file one part at a time. </li></ul><ul><li>command requires one argument – name of the file. </li></ul>

24.
Working with Files <ul><li>“– l” option used with wc command to only count number of lines in file. </li></ul><ul><li>“ -c” option: count characters in file. </li></ul><ul><li>“ -w” option : count number of words in file. </li></ul>

25.
Redirecting Output from a Utility <ul><li>By default, results provided by any utility are displayed on user’s screen. </li></ul><ul><li>Instructions can be given to redirect output of utility to file. </li></ul><ul><li>command- redirect output of file: “utility > filename” . </li></ul><ul><li>> is instruction to redirect output to new file </li></ul>

26.
Redirecting Output from a Utility <ul><li>double redirect (>>): append output of utility to end of existing file </li></ul><ul><li>| (pipe) command: redirect output of one utility to another utility. </li></ul><ul><li>The argument following the pipeline must be a utility. </li></ul>

27.
Determining the Role of Tokens on Command-Lines <ul><li>Each word or object on a command-line is called a token . </li></ul><ul><li>shell is programmed to read initial token as utility program to run or some action to take </li></ul><ul><li>location on command-line determines how shell interprets each token. </li></ul>

30.
Reissuing Commands <ul><li>Up arrow key: display previously entered commands one at a time. </li></ul><ul><li>shell keeps track of commands we issue at prompt. </li></ul><ul><li>“ history ” command: list all commands entered previously, and every command has a number associated with it. </li></ul>

32.
Using Nicknames for Commands <ul><li>An “ alias ” or alternate name used for commands hard to remember. </li></ul><ul><li>alias command can list all current aliases. </li></ul><ul><li>command “ unalias alias name ” can remove an alias. </li></ul>

33.
Using Nicknames for Commands Nicknames for commands in UNIX/Linux Command Shell alias alias name utility name Csh and tch alias alias name=utility name Bash and ksh

34.
Navigating the File System <ul><li>arrangement of files and folders in system: file system </li></ul><ul><li>“ pwd ” ( present working directory ) command can get location of user’s home directory </li></ul><ul><li>result displays path from root to present working directory </li></ul>

36.
Navigating the File System <ul><li>“ mkdir ” ( make directory ) command: create new directory </li></ul><ul><li>command requires 1 argument – name to give to directory </li></ul><ul><li>“– F” option used with ‘ ls ’ command to include a / (slash) after all directory names and also to identify other kinds of files. </li></ul>

37.
Navigating the File System <ul><li>“ cd ” command can make directory the current directory. </li></ul><ul><li>command requires 1 parameter – name of directory to become current directory </li></ul><ul><li>cd command: return to home directory. no required parameters </li></ul>

38.
Examining and Managing Files <ul><li>Find matching text: </li></ul><ul><ul><li>A particular word in a file can be located by giving the command “ /word to be located ” . </li></ul></ul><ul><ul><li>“ n ” key can locate next instance of same word in file. </li></ul></ul><ul><ul><li>“ b ” key can be used to move one screen backwards. </li></ul></ul>

39.
Examining and Managing Files <ul><li>“ head ” utility: read first 10 lines of file </li></ul><ul><li>“ tail ” utility”: view last 10 lines of file </li></ul><ul><li>Both utilities require 1 argument – name of file to read </li></ul><ul><li>number of lines to read can be passed as argument to utilities. </li></ul>

41.
Examining and Managing Files <ul><li>Copy files: </li></ul><ul><ul><li>“ cp ” command: make copy of existing file, as well as copy files to another subdirectory. </li></ul></ul><ul><ul><li>2 arguments are required to duplicate file – name of existing file and name to give duplicated file. </li></ul></ul><ul><ul><li>arguments required to copy file to another subdirectory are – name of file to copy and target directory </li></ul></ul>

43.
Examining and Managing Files <ul><li>Removing files (cont): </li></ul><ul><ul><li>rm command does its work and displays prompt. It displays no message. </li></ul></ul><ul><ul><li>“ -i” option: ask for confirmation before deleting any filenames listed as an argument. </li></ul></ul><ul><ul><li>command also accepts multiple file names as arguments. </li></ul></ul>

44.
Examining and Managing Files <ul><li>Renaming files: </li></ul><ul><ul><li>“mv” command: rename files, as well as move files from one location to another. </li></ul></ul><ul><ul><li>2 arguments are required while renaming files – current name of file and new name to give file </li></ul></ul><ul><ul><li>arguments required for moving files – name of files to move and destination directory </li></ul></ul>

48.
Accessing the Programmer’s Manual <ul><li>manual contains detailed documentation on use and function of utility programs, application programs, and libraries. </li></ul><ul><li>manual also contains info on UNIX system files and system programming libraries. </li></ul><ul><li>includes supplementary info on related special files and commands for each entry. </li></ul>

52.
Summary <ul><li>We can work on many utilities, print files, and access system folders from a shell. </li></ul><ul><li>Files can be printed from shell prompt. </li></ul><ul><li>Online manual pages provide detailed description of system utilities, files, and functionalities. </li></ul><ul><li>Internet includes useful sites that provide info on various aspects of UNIX and Linux. </li></ul>