Basic Introduction to UNIX/Linux

Basic Introduction to UNIX/Linux

Basic Introduction to UNIX/linux Claude Cantin ([email protected]) http://www.nrc.ca/imsb/rcsg Research Computing Support Group Information Management Services Branch National Research Council April 9, 2006 2 This page intentionally left blank. 3 This document was produced by Claude Cantin of the National Research Council of Canada. Reproductions are permitted for non-profit purposes provided the origin of the document is acknowledged. Claude Cantin National Research Council of Canada 4 History of printing: Date Copies March 2003 200 March 2001 200 June 1999 200 November 1997 200 July 1996 200 November 1995 150 March 1995 150 February 1994 150 October 1993 100 August 1993 75 February 1993 75 November 1992 35 September 1992 40 February 1992 50 December 1991 50 April 1991 50 September 1990 40 January 1990 40 Table 1: Printings. Contents 1 Introduction 3 1.1 History . 4 1.1.1 BSD: Berkeley System Distribution . 5 1.1.2 XENIX . 5 1.1.3 Linux . 5 1.1.4 System V (formerly known as \AT&T" System V) . 6 1.2 History (continued) . 6 1.3 The UNIX Operating System . 9 1.3.1 Multi-tasking, Time Sharing . 9 1.3.2 Multi-user . 11 1.3.3 Network Capabilities . 11 1.3.4 Portability . 11 1.3.5 Flexibility . 11 1.3.6 Software Available . 12 1.3.7 Virtual Memory . 13 1.3.8 Case Sensitivity . 13 1.4 UNIX Philosophy . 13 1.5 Exercises . 13 2 File System 15 2.1 File and Directory Names . 15 2.1.1 Length . 15 2.1.2 Conventions . 15 2.2 Structure of Directories, Files . 16 2.3 Permissions/File Access Modes . 16 2.3.1 chmod: Change Mode (Permissions) . 18 2.4 Exercises . 20 i ii CONTENTS 3 Tour of the File system 21 3.1 /: Root . 21 3.2 /bin and /usr/bin: Commands . 21 3.3 /dev: Devices . 22 3.4 /etc and /usr/etc: Management . 22 3.5 Home Directories . 22 3.6 /lib and /usr/lib: Libraries . 23 3.7 /tmp: Temporary Directories . 23 3.8 /var: Directories . 23 3.8.1 /var/adm: Administration . 23 3.8.2 /var/mail: System Mailboxes . 24 3.8.3 /var/spool: Spooling Areas . 24 3.8.4 /var/tmp: Temporary Directory . 24 3.9 /usr: Directories . 24 3.9.1 /usr/bsd: Berkeley Binaries . 24 3.9.2 /usr/demos: Demonstration . 24 3.9.3 /usr/include: Include Files . 25 3.9.4 /usr/local: Local Programs . 25 3.9.5 /usr/sbin: More Binaries . 25 3.9.6 /usr/share: Shareable Directories . 25 /usr/share/lib/dict: Dictionary . 25 /usr/share/lib/Insight: Documentation . 26 /usr/share/doc: Linux Documentation . 26 /usr/share/lib/spell: Speller . 26 /usr/share/lib/terminfo: Terminal Database . 26 /usr/share/man and /usr/share/catman: Manuals . 26 3.9.7 /usr/tmp: Temporary . 26 3.10 Exercises . 27 4 Shells 29 4.1 Input/Output Redirection . 30 4.1.1 <: Input Redirection . 30 4.1.2 >, >>: Standard Output . 31 4.1.3 2>, >&: Standard Diagnostic (Error) Output . 31 4.2 j: Pipes . 32 4.3 Pipes and Redirections . 33 4.4 &: Background Processing . 33 4.5 Metacharacters (Wildcards) . 34 CONTENTS iii 4.5.1 ∗: Any Character(s) . 34 4.5.2 [,]: List of Characters . 34 4.5.3 ?: Any Single Character . 35 4.5.4 f,g: Alternatives (except Korn Shell) . 35 4.5.5 n: Escape . 35 4.6 Shell/Job Control . 35 4.6.1 jobs: list background jobs . 36 4.6.2 CTL-Z: suspend a job . 36 4.6.3 bg: send a job in the backgroup . 37 4.6.4 fg: bring a job in the foreground . 37 4.6.5 CTL-C: kill a job . 37 4.6.6 Sample session . 37 4.7 C Shell . 38 4.7.1 path: Search Path . 38 4.7.2 history . 39 4.7.3 alias . 40 4.8 Tenex Shell . 40 4.9 Bourne Shell . 41 4.9.1 PATH . 41 4.9.2 history . 42 4.9.3 alias . 42 4.10 Korn Shell . 42 4.10.1 PATH: Search Path . 42 4.10.2 history . 42 4.10.3 aliases . 44 4.10.4 Other Miscellaneous Commands . 44 4.11 Bash Shell . 45 4.11.1 PATH: Search Path . 45 4.11.2 history . 45 4.11.3 aliases . 45 4.12 Exercises . 46 5 Basic Security 49 5.1 File Permissions . 49 5.2 Passwords . 49 5.3 Root Password . 50 5.4 SSH . 50 5.5 TCP Wrappers . 51 iv CONTENTS 5.6 Exercises . 51 6 Commands I 53 6.1 A Command is a File . 53 6.2 Syntax . 54 6.3 Login Related Commands . 54 6.3.1 Logging On . 54 6.3.2 Changing Password . 55 6.3.3 Logging Out . 55 6.4 Help . 55 6.4.1 man: Manual Pages . 56 6.4.2 Manuals on CDs . 56 6.5 File system Commands: Directories . 58 6.5.1 cd: Change Directory . 58 6.5.2 mkdir: Make Directory . 58 6.5.3 rmdir: Remove Directory . 59 6.5.4 pwd: Print Working Directory . 59 6.5.5 cp: Copy . 59 6.5.6 mv: Move . 60 6.6 File system Commands: Files . 60 6.6.1 ls: Listing . 61 6.6.2 cp: Copy . 62 6.6.3 mv: Move . 63 6.6.4 ln: Link . 64 6.6.5 touch: Update . 65 6.6.6 rm: Remove . 65 6.6.7 cat: Concatenate . 66 6.6.8 more: Browser . 66 6.6.9 head: Header . 67 6.6.10 tail: Tail End . 67 6.6.11 wc: Word Count . 68 6.6.12 diff: Difference . 68 6.6.13 file: Type of File . 69 6.7 Printer Commands (Berkeley; lpr/lprm) . 70 6.7.1 lpr: Line Printer . 70 6.7.2 lpq: Line Printer Queue, Statistics . 70 6.7.3 lprm: Line Printer Remove . 71 6.8 Printer Commands (System V; lp/cancel) . 71 CONTENTS v 6.8.1 lp: Line Printer . 72 6.8.2 lpstat: Line Printer Queue, Statistics . 72 6.8.3 cancel: Line Printer Remove . 73 6.9 Printer Commands (linux; kprinter) . 73 6.10 User Related Commands . 73 6.10.1 who: Who is On . ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    192 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us