You are previewing Introduction to Unix and Shell Programming.
O'Reilly logo
Introduction to Unix and Shell Programming

Book Description

Introduction to Unix and Shell Programming is designed to be an introductory first-level book for a course on Unix. Organised into twelve simple chapters, the book guides the students from the basic introduction to the Unix operating system and ext

Table of Contents

  1. Cover
  2. Title Page
  3. Contents
  4. Dedication
  5. Preface
  6. 1. Introduction to Unix
    1. 1.1. Brief History
    2. 1.2. What is Unix?
    3. 1.3. Unix Components
    4. 1.4. Using Unix
    5. 1.5. Commands in Unix
    6. 1.6. Some Basic Commands
    7. 1.7. Getting Help
    8. 1.8. Command Substitution
    9. 1.9. Giving Multiple Commands
    10. 1.10. Aliases—Giving Alternate Names to Commands
    11. Review Questions and Exercises
  7. 2. Files and File Organization
    1. 2.1. Unix Files
    2. 2.2. Categories of Files
    3. 2.3. Hidden Files—Dot Files
    4. 2.4. The File System—Organizing the Unix Files
    5. 2.5. Path Names—Reaching a Required File
    6. 2.6. The Home Directory
    7. 2.7. Directory Commands
    8. 2.8. The Dot (.) and Double Dot (. .) File Names
    9. 2.9. File Related Commands
    10. 2.10. Wild Cards—Filename Generation
    11. 2.11. Displaying the Contents of a File
    12. 2.12. Printing of Files
    13. 2.13. Comparing Files
    14. Review Questions and Exercises
  8. 3. File Attributes and Permissions
    1. 3.1. Ownership of Files
    2. 3.2. File Attributes
    3. 3.3. The is Command—Revisited
    4. 3.4. The file Command—Knowing the File Type
    5. 3.5. The chmod Command—Changing File Permissions
    6. 3.6. The chown Command—Changing the Owner of a File
    7. 3.7. The chgrp Command—Changing the group of a File
    8. 3.8. Times Associated with a File
    9. 3.9. The umask Command—Default File Permissions
    10. Review Questions and Exercises
  9. 4. Standard I/O, Redirection Pipes and Filters
    1. 4.1. Standard I/O
    2. 4.2. Redirection
    3. 4.3. Pipe and Pipeline—Connecting Commands
    4. 4.4. Mixing Inputs from Standard Input and a File
    5. 4.5. Filter
    6. 4.6. The tee Command
    7. 4.7. Terminal (/dev/tty) and Trash (/dev/null) Files
    8. 4.8. A Sample Database File
    9. 4.9. Handling Columns and Fields
    10. 4.10. The sort Command
    11. 4.11. The uniq Command
    12. 4.12. The tr Command
    13. Review Questions and Exercises
  10. 5. The vi Editor
    1. 5.1. The vi Editor
    2. 5.2. Editing with vi
    3. 5.3. Moving the Cursor
    4. 5.4. Editing
    5. 5.5. Copying and Moving Text
    6. 5.6. Pattern Searching
    7. 5.7. Repeating the Last Editor Command
    8. 5.8. Undoing Commands
    9. 5.9. Joining Lines
    10. 5.10. Writing Selected Lines onto a Separate File
    11. 5.11. Using the Shell from vi
    12. 5.12. Configuring the vi Environment
    13. Review Questions and Exercises
  11. 6. Regular Expressions—grep Family of Commands and the sed
    1. 6.1. Regular Expressions
    2. 6.2. The grep Family
    3. 6.3. The egrep Command
    4. 6.4. The fgrep Command
    5. 6.5. The Stream Editor—sed
    6. Review Questions and Exercises
  12. 7. The Process
    1. 7.1. The Meaning
    2. 7.2. Parent and Child Processes
    3. 7.3. Types of Processes
    4. 7.4. More about Foreground and Background Processes
    5. 7.5. Internal and External Commands
    6. 7.6. The ps Command—Knowing Process Attributes
    7. 7.7. Process Creation
    8. 7.8. The nohup Command
    9. 7.9. The nice Command
    10. 7.10. The time Command
    11. 7.11. Signals
    12. 7.12. The trap Command
    13. 7.13. The stty Command
    14. 7.14. The kill Command
    15. 7.15. The wait Command
    16. 7.16. Job Control
    17. 7.17. Command History
    18. 7.18. Scheduling Jobs' Execution
    19. Review Questions and Exercises
  13. 8. Shell Programming
    1. 8.1. Shell Variables
    2. 8.2. The export Command
    3. 8.3. The .profile File—A Script Run during Starting
    4. 8.4. The First Shell Script
    5. 8.5. The read Command
    6. 8.6. Positional Parameters
    7. 8.7. The $? Variable—Knowing the Exit Status
    8. 8.8. More about the set Command
    9. 8.9. The exit Command
    10. 8.10. Branching Control Structures
    11. 8.11. Loop-Control Structures
    12. 8.12. The continue and break Statements
    13. 8.13. The expr Command: Performing Integer Arithmetic
    14. 8.14. Real Arithmetic in Shell Programs
    15. 8.15. The here Document (<<)
    16. 8.16. The sleep Command
    17. 8.17. Debugging Scripts
    18. 8.18. The script Command
    19. 8.19. The eval Command
    20. 8.20. The exec Command
    21. 8.21. More Scripts
    22. Review Questions and Exercises
  14. 9. AWK
    1. 9.1. Syntax of an awk Program Statement
    2. 9.2. Structure of an awk Script
    3. 9.3. Operational Mechanism of awk
    4. 9.4. Variables
    5. 9.5. Records, Fields and Special Variables
    6. 9.6. Addressing: Line and Context Addressing
    7. 9.7. Patterns
    8. 9.8. Operators
    9. 9.9. Sample Input Files
    10. 9.10. Simple awk Programs
    11. 9.11. awk Control Structures
    12. 9.12. Functions in awk
    13. 9.13. Script on a File—The First Complete Script
    14. 9.14. Executing awk Scripts with the Shell
    15. 9.15. Arrays
    16. 9.16. Salary-Computing Script
    17. Review Questions and Exercises
  15. 10. Basic Communication Tools
    1. 10.1. The Communication Process
    2. 10.2. The news Command
    3. 10.3. Message of the Day—The motd
    4. 10.4. The mesg Command
    5. 10.5. The write Command
    6. 10.6. The wall Command
    7. 10.7. The talk Command
    8. 10.8. The finger Command—Detailed Information on Users
    9. 10.9. Electronic Mail
    10. Review Questions and Exercises
  16. 11. Introduction to Perl
    1. 11.1. Structure of a Perl Script
    2. 11.2. Running a Perl Script
    3. 11.3. Perl Data
    4. 11.4. Print Functions
    5. 11.5. Some String Operators
    6. 11.6. The Current Line and the Current Line Number
    7. 11.7. Lists and Arrays in Perl
    8. 11.8. List Operators
    9. 11.9. Handling Files
    10. 11.10. The chop() and chomp() Functions
    11. 11.11. Associative Arrays (Hashes)
    12. 11.12. Contexts
    13. 11.13. Decision-Making and Loop-Control Structures
    14. 11.14. Regular Expressions
    15. 11.15. The Match Operator (m/ /)
    16. 11.16. The Substitute Operator (s/ / /)
    17. 11.17. Multiple search Patterns
    18. 11.18. Anchors
    19. 11.19. Sub-Routines
    20. 11.20. Example Scripts
    21. Review Questions and Exercises
  17. 12. Introduction to System Administration
    1. 12.1. System Administrator or Superuser
    2. 12.2. Unix Security
    3. 12.3. Managing Disk Space
    4. 12.4. Backup and Restore
    5. 12.5. The find Command: Locating Files
    6. 12.6. The Inode and Its Structure
    7. 12.7. File Systems
    8. 12.8. File Links: The in Command
    9. Review Questions and Exercises
  18. Acknowledgements
  19. Copyright Page