0
Lesson 2-Touring Essential  Programs
Overview <ul><li>Development of UNIX and Linux. </li></ul><ul><li>Commands to execute utilities. </li></ul><ul><li>Communi...
Development of UNIX and Linux  <ul><li>UNIX os, developed in 1970s at Bell Laboratories, features: </li></ul><ul><ul><ul><...
Development of UNIX and Linux  <ul><li>Linus Torvalds   wrote  a UNIX look-alike operating system called  Linux . </li></u...
<ul><li>fundamental programs in  Linux  employ  same   code , but different distributors add special features and installa...
Commands to Execute Utilities  <ul><li>Introduction to the shell. </li></ul><ul><li>Issuing commands to a shell. </li></ul...
Introduction to the Shell  <ul><li>shell: program which displays prompt on screen. </li></ul><ul><li>shell reads instructi...
Issuing Commands to a Shell  <ul><li>Various utilities can be executed from the shell prompt. </li></ul><ul><li>“ whoami ”...
Issuing Commands to a Shell  <ul><li>“ clear ” utility to clear all text on screen and display the prompt at top of screen...
Issuing Commands to a Shell  Output of  who  Command
Issuing Commands to a Shell  <ul><li>port:  physical location at back of computer. </li></ul><ul><li>Each port has designa...
Issuing Commands to a Shell  <ul><li>command/utility keyed in by a user is followed by the  ENTER  key. </li></ul><ul><li>...
Issuing Commands to a Shell  <ul><li>shell locates path of utility/command and executes it. </li></ul><ul><li>output, by d...
Issuing Commands to a Shell  How the shell works
Passing Information to a Utility  <ul><li>When information passed to a utility, shell runs utility, and passes information...
Passing Information to a Utility  <ul><li>“ cal ” program provides users current month’s calendar. </li></ul><ul><li>Multi...
Passing Information to a Utility  <ul><li>“ look ” command to locate words in dictionary file that begin with that word, a...
Listing Processes  <ul><li>A  process  is an instance of a running program code. </li></ul><ul><li>“ ps ” command to list ...
Listing Processes  <ul><li>“ – aux ” and “ –ef ”  options  used with “ ps ” command to display processes running on entire...
Communicating Instructions to the  Shell  <ul><li>Every user is given a place, called  home directory , to work with and s...
Communicating Instructions to the  Shell  <ul><li>Working with files. </li></ul><ul><li>Redirecting output from a utility....
Working with Files <ul><li>“ ls ” (list) command lists contents of current directory’s standard files. </li></ul><ul><li>“...
<ul><li>spacebar:  display additional text in file displayed by more. </li></ul><ul><li>“ q ” key can to  quit  ‘ more ’ u...
Working with Files <ul><li>“– l” option  used with  wc  command to only  count  number of  lines  in file. </li></ul><ul><...
Redirecting Output from a Utility  <ul><li>By default, results provided by any utility are displayed on user’s screen. </l...
Redirecting Output from a Utility  <ul><li>double redirect (>>):  append output of utility to end of existing file </li></...
Determining the Role of Tokens on Command-Lines  <ul><li>Each word or object on a command-line is called a  token . </li><...
Starting a Child Shell List of Various Shells in UNIX/Linux
Reissuing Commands  <ul><li>“ !!”  command or  “r”  command: re-execute previously entered command. </li></ul><ul><li>“ !!...
Reissuing Commands  <ul><li>Up arrow  key: display previously entered commands one at a time. </li></ul><ul><li>shell keep...
Reissuing Commands  Various Options to Execute Previous Commands
Using Nicknames for Commands  <ul><li>An “ alias ” or  alternate name  used for commands hard to remember. </li></ul><ul><...
Using Nicknames for Commands  Nicknames for commands in UNIX/Linux Command Shell alias alias name utility name Csh and tch...
Navigating the File System  <ul><li>arrangement of files and folders in system:  file system </li></ul><ul><li>“ pwd ” ( p...
<ul><li>topmost directory: “ root ”  (identified as  / ) </li></ul><ul><li>“ ls / ” command can obtain a list of all files...
Navigating the File System  <ul><li>“ mkdir ” ( make directory ) command: create new directory </li></ul><ul><li>command r...
Navigating the File System  <ul><li>“ cd ” command can make directory the current directory. </li></ul><ul><li>command req...
Examining and Managing Files  <ul><li>Find matching text: </li></ul><ul><ul><li>A particular word in a file can be located...
Examining and Managing Files  <ul><li>“ head ” utility: read first 10 lines of file </li></ul><ul><li>“ tail ” utility”: v...
Examining and Managing Files  <ul><li>cat  utility: view entire contents of file </li></ul><ul><li>utility requires 1 argu...
Examining and Managing Files  <ul><li>Copy files: </li></ul><ul><ul><li>“ cp ” command: make copy of existing file, as wel...
Examining and Managing Files  <ul><li>Removing files: </li></ul><ul><ul><li>“ rm ” command: delete file </li></ul></ul><ul...
Examining and Managing Files  <ul><li>Removing files (cont): </li></ul><ul><ul><li>rm command does its work and displays p...
Examining and Managing Files  <ul><li>Renaming files: </li></ul><ul><ul><li>“mv” command: rename files, as well as move fi...
Examining and Managing Files  <ul><li>Deciphering utility error messages: </li></ul><ul><ul><li>Error messages  due to fai...
Examining and Managing Files  <ul><li>Printing file: </li></ul><ul><ul><li>“ lp ” or “ lpr ” command: print file </li></ul...
Accessing the Programmer’s Manual  <ul><li>UNIX and Linux systems include extensive collection of powerful utility program...
Accessing the Programmer’s Manual  <ul><li>manual contains detailed documentation on use and function of utility programs,...
Accessing the Programmer’s Manual  <ul><li>man  command: provide online manual entry for utility or command </li></ul><ul>...
Accessing Internet Resources  <ul><li>Internet includes many useful sites that provide info on: </li></ul><ul><ul><ul><li>...
Summary  <ul><li>shell: process that interprets commands entered by user </li></ul><ul><li>Each word or object on command-...
Summary  <ul><li>We can work on many utilities, print files, and access system folders from a shell. </li></ul><ul><li>Fil...
Upcoming SlideShare
Loading in...5
×

intro unix/linux 02

3,026

Published on

touring essential programs

Published in: Business, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,026
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
532
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "intro unix/linux 02"

  1. 1. Lesson 2-Touring Essential Programs
  2. 2. Overview <ul><li>Development of UNIX and Linux. </li></ul><ul><li>Commands to execute utilities. </li></ul><ul><li>Communicating instructions to the shell. </li></ul><ul><li>Navigating the file system. </li></ul><ul><li>Examining and managing files. </li></ul><ul><li>Accessing the programmer’s manual. </li></ul><ul><li>Accessing Internet resources. </li></ul>
  3. 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. 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. 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. 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. 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. 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. 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>
  10. 10. Issuing Commands to a Shell Output of who Command
  11. 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. 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>
  13. 13. Issuing Commands to a Shell <ul><li>shell locates path of utility/command and executes it. </li></ul><ul><li>output, by default, connected to screen, unless redirect it. </li></ul><ul><li>After executing command/utility, it returns command prompt again. </li></ul>
  14. 14. Issuing Commands to a Shell How the shell works
  15. 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. 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. 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. 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>
  19. 19. Listing Processes <ul><li>“ – aux ” and “ –ef ” options used with “ ps ” command to display processes running on entire system, including system processes, and list of currently logged on users. </li></ul><ul><li>Arguments that begin with minus (-) sign are options . </li></ul><ul><li>ps option useful for sys-admin trouble-shooting system. </li></ul>
  20. 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. 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. 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>
  23. 23. <ul><li>spacebar: display additional text in file displayed by more. </li></ul><ul><li>“ q ” key can to quit ‘ more ’ utility. </li></ul><ul><li>“ wc ” ( word count ) utility: count number of lines, words, and characters in file. </li></ul><ul><li>command requires one parameter – name of the file. </li></ul>Working with Files
  24. 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. 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. 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. 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>
  28. 28. Starting a Child Shell List of Various Shells in UNIX/Linux
  29. 29. Reissuing Commands <ul><li>“ !!” command or “r” command: re-execute previously entered command. </li></ul><ul><li>“ !!” command works only on csh , tch , or bash shell. </li></ul><ul><li>The “r” command works only on a Korn shell. </li></ul><ul><li>The sh shell does not allow user to re-execute previously entered commands. </li></ul>
  30. 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>
  31. 31. Reissuing Commands Various Options to Execute Previous Commands
  32. 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. 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. 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>
  35. 35. <ul><li>topmost directory: “ root ” (identified as / ) </li></ul><ul><li>“ ls / ” command can obtain a list of all files and directories in root directory </li></ul>Navigating the File System
  36. 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. 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. 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. 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>
  40. 40. Examining and Managing Files <ul><li>cat utility: view entire contents of file </li></ul><ul><li>utility requires 1 argument – name of file to read. </li></ul><ul><li>utility is preferable when file small </li></ul>
  41. 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>
  42. 42. Examining and Managing Files <ul><li>Removing files: </li></ul><ul><ul><li>“ rm ” command: delete file </li></ul></ul><ul><ul><li>command requires 1 argument – name of file to delete </li></ul></ul>
  43. 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. 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>
  45. 45. Examining and Managing Files <ul><li>Deciphering utility error messages: </li></ul><ul><ul><li>Error messages due to failure of utility are shown in screen by default. </li></ul></ul><ul><ul><li>Every process has &quot; output door &quot;, where it writes output, and an error door, where it writes error messages. </li></ul></ul><ul><ul><li>By default, &quot; error door &quot; connected to screen unless we redirect it. </li></ul></ul>
  46. 46. Examining and Managing Files <ul><li>Printing file: </li></ul><ul><ul><li>“ lp ” or “ lpr ” command: print file </li></ul></ul><ul><ul><li>command requires 1 argument – name of file to print. </li></ul></ul><ul><ul><li>“– P” option with “ lpr ” command, and “-d” option with the lp command, can specify name of printer to use </li></ul></ul>
  47. 47. Accessing the Programmer’s Manual <ul><li>UNIX and Linux systems include extensive collection of powerful utility programs, system features, application languages, and support libraries. </li></ul><ul><li>The UNIX programmer’s manual provides info needed to employ exact syntax of a particular option or command format for a utility. </li></ul>
  48. 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>
  49. 49. Accessing the Programmer’s Manual <ul><li>man command: provide online manual entry for utility or command </li></ul><ul><li>command requires 1 argument – name of utility or command </li></ul><ul><li>“ man –k” command: search manual pages’ descriptions for keywords. </li></ul>
  50. 50. Accessing Internet Resources <ul><li>Internet includes many useful sites that provide info on: </li></ul><ul><ul><ul><li>Recent news in Linux world (www.linux.org/www.linux.com). </li></ul></ul></ul><ul><ul><ul><li>Interactive Web tutorials </li></ul></ul></ul><ul><ul><ul><li>Recent software updates and Linux code documentation. </li></ul></ul></ul>
  51. 51. Summary <ul><li>shell: process that interprets commands entered by user </li></ul><ul><li>Each word or object on command-line: token </li></ul><ul><li>All shells, except for sh, allow users to create alias names for commands </li></ul><ul><li>file system: collection of files and folders </li></ul>
  52. 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>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×