You are previewing UNIX® User’s Handbook, Second Edition.
O'Reilly logo
UNIX® User’s Handbook, Second Edition

Book Description

The in-depth UNIX guide for every end-user: completely updated and full of examples!

  • For every key UNIX platform: practical examples, real depth!

  • Covers all basic UNIX commands, plus sed, grep, awk, vi, and more

  • Complete shell programming coverage—plus NEW programming section covering C/C++, Java(tm), and Internet development

  • KornShell, Bash, C Shell, and Shell Programming

  • Windows interoperability, in depth: Samba, NFS, Windows 2000 Services for UNIX, and much more

  • UNIX end-users desperately need an up-to-date reference guide with real depth: one that teaches UNIX commands and doesn't just list them! In UNIX User's Handbook, Second Edition, best-selling UNIX author Marty Poniatowski covers every topic UNIX users need to master—with exceptional clarity and practical, real-world examples. Part I brings together thorough coverage of virtually every key aspect of day-to-day UNIX operation and end-user administration. Part II presents an in-depth programming reference. Part III covers every leading option for Windows interoperability. You'll find fast, easy answers for all this and more:

  • Getting started: login, mail, Internet access, and key UNIX file management commands

  • All basic UNIX commands and a complete UNIX file system overview (cd, cp, file, ls, mv, pwd, rm, rmdir, cut, paste, split, sort, diff, and more)

  • Key UNIX tools—including in-depth coverage of find, vi, find, grep, sed, and awk

  • Shells and shell programming: Bash, Korn, and C

  • Full programming section—including a NEW user-centered introduction to C/C++ and Java

  • End-user administration: processes, startup, shutdown, users/groups, backup, software management, printing, and more

  • Networking and Internet protocols

  • UNIX/Windows interoperability: Samba, X Window, NFS, Posix, Windows 2000 Services for UNIX, and other alternatives

  • Performance and monitoring

  • This new edition has been updated throughout and redesigned for even faster, easier access to information. Whatever your experience, whatever UNIX version you use, you won't find a more useful reference!

    Table of Contents

    1. Copyright
    2. FOREWORD
    3. PREFACE
      1. UNIX Section
      2. Programming Section
      3. UNIX and Windows® Interoperability Section
      4. A Word about the UNIX Variants Used throughout This Book
      5. Relevant URLs
      6. Manual Pages Included in This Book
      7. Conventions Used in the Book
      8. Acknowledgments
        1. William Russell
        2. Elizabeth Zinkann
        3. Donna Kelly
        4. Carollyn M. Carson
        5. Thom Fitzpatrick
        6. Marty Poniatowski - Author
        7. Reviewers
    4. 1. Getting Started - Login, Mail, Internet Access, UNIX Components
      1. Introduction
      2. Multi-User UNIX
        1. Uppercase and Lowercase Letters
        2. Login Process
      3. Online Manual Pages
      4. Electronic Mail
      5. Accessing the Internet
      6. UNIX Components
    5. 2. UNIX File System Introduction- File System Layout, file and ls Commands
      1. The Basics of UNIX
      2. File Types
        1. Text Files
        2. Data Files
        3. Source Code File
        4. Executable Files
        5. Shell Programs
        6. Links
        7. Device Files
      3. The file Command
        1. Text File (UNIX example)
        2. Text File (Linux example)
        3. Data File (UNIX example)
        4. Source Code File (UNIX example)
        5. Source Code File (Linux example)
        6. Executable File (UNIX example)
        7. Executable File (Linux example)
        8. Shell Program (UNIX example)
        9. Shell Program (Linux example)
        10. Link (UNIX example)
        11. Link (Linux example)
        12. Block Device File (UNIX example)
        13. Block Device File (Linux example)
        14. Character Device File (UNIX example)
        15. Character Device File (Linux example)
      4. The ls Command
        1. ls
        2. ls -a
        3. ls -l
        4. ls -i
        5. ls -p
        6. ls -R
        7. ls Summary
      5. File System Layout
      6. Linux File System Layout
      7. Manual Pages for Some Commands Used in Chapter 2
        1. file
        2. ls
    6. 3. Working with Files and Directories - Permissions, Commands, File Name Expansion, and Wild Cards
      1. Introduction
      2. Permissions
      3. Absolute and Relative Path Names
      4. File Name Expansion and Wild Cards
      5. pwd and cd
      6. chmod
      7. cp
      8. mv
      9. mkdir
      10. rm
      11. rmdir
      12. Using Commands
        1. Using the cd, pwd, ls, mkdir, and cp Commands
        2. Using the mv Command
        3. Down and Dirty with the rm and rmdir Commands
      13. Manual Pages for Some Commands Used in Chapter 3
        1. cd
        2. chmod
        3. cp
        4. mkdir
        5. mv
        6. pwd
        7. rm
        8. rmdir
    7. 4. Viewing Files - Redirection, cat, more, pg, head, and tail Commands
      1. First Things First
      2. Redirection
      3. Viewing Files with cat, more, pg, head, and tail
      4. Manual Pages for Some Commands Used in Chapter 4
        1. cat
        2. head
        3. more
        4. pg
        5. tail
    8. 5. UNIX Tools - split, wc, sort, cmp, diff, comm, dircmp, cut, paste, join, and tr
      1. Not All Commands on All UNIX Variants
      2. split
      3. wc
      4. sort
      5. cmp, diff, and comm
      6. dircmp
      7. cut
      8. paste
      9. tr
      10. Manual Pages for Some Commands Used in Chapter 5
        1. cmp
        2. comm
        3. cut
        4. diff
        5. dircmp
        6. join
        7. paste
        8. sort
        9. tr
        10. wc
    9. 6. Advanced UNIX Tools - Regular Expressions, sed, awk, and grep
      1. Three Commands
      2. Regular Expression Words-of-Caution
      3. Expressions Are Strings and Wildcards
      4. sed
      5. awk
      6. grep
      7. Manual Pages for Some Commands Used in Chapter 6
        1. awk
        2. grep
        3. sed
    10. 7. find Command
      1. find Overview
      2. Finding Files of a Specific Type
      3. Find Empty Files and Directories
      4. Finding Files By Name, Size, and Both Name and Size
      5. Finding Files By Owner, Type, and Permissions
      6. Finding Long Unaccessed Files and Running Commands on Found Files
      7. find Summary
      8. Manual Pages for find Command Used in Chapter 7
        1. find
    11. 8. The vi Editor
      1. The vi Editor
      2. Regular Expression Words-of-Caution
      3. Expressions Are Strings and Wildcards
      4. Modes and Notations
      5. Starting a vi Session
      6. Cursor Control Commands
      7. Adding Text in vi
      8. Deleting Text in vi
      9. Changing Text in vi
      10. Search and Replace in vi
      11. Copying Text in vi
      12. Undo and Repeat in vi
      13. Save Text and Exit vi
      14. Options in vi
      15. Status in vi
      16. Section Positioning and Placing Marks in Text
      17. Joining Lines in vi
      18. Cursor Placement and Adjusting the Screen
      19. Shell Escape Commands
      20. Macros and Abbreviations
      21. Indenting Text
      22. Shell Filters
      23. Pattern Matching
        1. Matching a Set
        2. Matching a Range
        3. Beginning and End of Line Search
      24. Manual Pages for vi Command Used in Chapter 8
        1. vi
    12. 9. Introduction to the Bash Shell
      1. Different Shells
      2. Introduction to Bash
        1. Issuing Commands
        2. Initializing the History List in .bashrc
        3. Recalling from the History List
        4. Editing on the Command Line
        5. Aliases in .bashrc
        6. Command and Path Completion
        7. File Name Expansion
        8. Redirection (I/O Redirection)
        9. Environment Variables
        10. Background Jobs and Job Control
        11. umask and Permissions
    13. 10. Introduction to the KornShell
      1. Different Shells
      2. Introduction to KornShell
        1. Startup Files
        2. The History File, .sh_history
        3. Recalling from the History List
        4. Re-executing Commands with r
        5. Fetching Commands Using vi Directives
        6. Editing on the Command Line Using vi Directives
        7. Aliases in KornShell
        8. Command and Path Completion
        9. File Name Expansion
        10. Redirection (I/O Redirection)
        11. Environment Variables
        12. Background Jobs and Job Control
        13. umask and Permissions
        14. Change File Permissions with chmod
      3. Manual Pages of Some Commands Used in Chapter 10
        1. kill
        2. ksh
        3. umask
    14. 11. Introduction to the C Shell
      1. Different Shells
      2. Introduction to the C Shell
        1. Issuing Commands
        2. The .cshrc File
        3. The .login File
        4. Initialize History List in .cshrc
        5. Command-Line History
        6. Re-Executing Commands from the History List
        7. Aliases in .cshrc
        8. File-Name Expansion
        9. Redirection (I/O Redirection)
        10. Shell and Environment Variables
        11. Background Jobs and Job Control
        12. umask and Permissions
        13. Change File Permissions with chmod
      3. Manual Pages of Some Commands Used in Chapter 11
        1. csh
    15. 12. Introduction to Shell Programming
      1. Shell Programming
      2. Steps to Create Shell Programs
      3. ksh Programming
        1. Shell Variables
        2. Command Substitution
        3. Reading User Input
        4. Arguments to Shell Programs
        5. Testing and Branching
        6. Making Decisions with the case Statement
        7. Looping
        8. The while Loop
        9. Shell Functions
        10. awk in Shell Programs
      4. An HP-UX Logical Volume Manager Shell Program
      5. C Shell Programming
        1. Command Substitution
        2. Reading User Input
        3. Testing and Branching
        4. Looping
        5. Decision Making with switch
        6. Debugging C Shell Programs
        7. How Long Does It Take?
      6. Manual Pages for Some Commands Used in Chapter 12
    16. 13. Introduction to System Administration
      1. System Administration
      2. Check Processes with ps
        1. Solaris example:
        2. AIX example:
        3. HP-UX example (partial listing):
      3. Killing a Process
      4. Signals
      5. System Startup and Shutdown Scripts
      6. An Alternative Startup and Shutdown Method
      7. System Shutdown
      8. Users and Groups
        1. Assigning Users to Groups
      9. Disk-Related Concepts
      10. Viewing Mounted Filesystems and Swap
      11. Determining Disk Usage
      12. System Backup
      13. Scheduling Cron Jobs
      14. Networking
      15. syslog and Log Files
      16. dmesg
      17. The Kernel
      18. Device Files
      19. Software Management
        1. Solaris pkg commands:
        2. HP-UX sw commands:
      20. Printing
        1. Graphical-Based Management Tools
      21. Manual Pages of Some Commands Used in Chapter 13
        1. cron
        2. df
        3. du
        4. group
        5. inittab
        6. mount
        7. newgrp
        8. passwd
        9. ps
        10. shutdown
        11. vipw
    17. 14. Introduction to UNIX Performance Tools
      1. Introduction
      2. Standard UNIX Commands
        1. I/O and CPU Statistics with iostat
        2. Virtual Memory Statistics with vmstat
          1. Solaris example:
          2. HP-UX example:
          3. AIX example:
          4. Linux example:
        3. Network Statistics with netstat
          1. Solaris example:
          2. HP-UX example (10.x):
          3. AIX example:
      3. Check Processes with ps
        1. Solaris example:
        2. AIX example:
        3. HP-UX example (partial listing):
      4. Killing a Process
      5. Signals
        1. Show Remote Mounts with showmount
        2. Show System Swap
        3. sar: The System Activity Reporter
        4. timex to Analyze a Command
      6. More Advanced and Graphical Performance Tools
      7. HP GlancePlus/UX
        1. Process List Description
        2. CPU Report Screen Description
        3. Memory Report Screen Description
        4. Disk Report Screen Description
        5. GlancePlus Summary
        6. Using VantagePoint Performance Agent to Identify Bottlenecks
      8. HP VantagePoint Performance Agent and HP VantagePoint Performance Analyzer/UX
      9. Manual Pages of Some Commands Used in Chapter 14
        1. iostat
        2. sar
        3. showmount
        4. swapinfo
        5. timex
        6. top
        7. vmstat
    18. 15. Common Desktop Environment
      1. Why a Graphical User Interface (GUI)?
      2. CDE Basics
        1. CDE on AIX and HP-UX
        2. CDE on Solaris
      3. Customizing CDE
        1. Making Changes Using Style Manager
          1. Font Size
          2. Backdrop and Colors
          3. Adding Objects to or Removing Objects from the Front Panel
          4. Adding Another Workspace
          5. Changing the Front Panel in Other Ways
          6. Modifying Things in Slide-Up Subpanels
          7. Changing the Default Printer Name Display
          8. Front Panel Animation
          9. Adding Items to the Workspace Menu
          10. Creating Control Buttons, Actions, and File Types
          11. Creating a New Icon and Action
          12. Using Different Fonts
          13. Changing the Login Messages
          14. Changing the Login Picture
      4. CDE - Advanced Topics
        1. The Relationship among X, Motif, and CDE
        2. The X Window System
        3. Motif
        4. CDE
      5. X, Motif, and CDE Configuration Files
        1. X Configuration Files
        2. Motif Configuration Files
        3. CDE Configuration Files
        4. CDE Configuration File Locations
        5. How Configuration Files Play Together
        6. Specifying Appearance and Behavior
      6. The Sequence of Events When CDE Starts
      7. CDE and Performance
        1. Tactics for Better Performance
      8. Conclusion
    19. 16. Networking
      1. UNIX Networking
      2. An Overview of IEEE802.3, TCP/IP
        1. Physical Layer
        2. Link Layer
        3. Network Layer
        4. Transport Layer
      3. Internet Protocol (IP) Addressing
        1. Subnet Mask
      4. Using Networking
      5. ARPA Services (Communication among Systems w/ Different OS)
      6. Berkeley Commands (Communication between UNIX Systems)
        1. Remote Copy (rcp)
        2. Remote login (rlogin)
        3. Remote shell (remsh)
        4. Remote who (rwho)
      7. Host Name Mapping
        1. /etc/hosts
        2. /etc/hosts.equiv
        3. /.rhosts
      8. Network File System (NFS)
      9. Other Networking Commands and Setup
        1. ping
        2. netstat
        3. route
        4. ifconfig
        5. rpcinfo
        6. arp
        7. lanadmin
        8. ndd
        9. nslookup
      10. Manual Pages of Some Commands Used in Chapter 16
        1. ftp
        2. ifconfig
      11. netstat
        1. ping
        2. rcp
        3. remsh
        4. rlogin
        5. route
        6. rpcinfo
        7. rwho
        8. telnet
    20. 17. Introduction to Software Development
      1. Introduction
      2. Understanding Computer Programs
      3. Compiled vs. Interpreted Languages
    21. 18. Programming Constructs
      1. Introduction
      2. Assignment Constructs
      3. Mathematical Operators
      4. Comparison Expressions
      5. Loop Constructs
      6. Choice Constructs
        1. If...then...else Statement
      7. Nested if...then...else Statement
        1. Case Statement
        2. Data Structures
    22. 19. Programming Design
      1. Introduction
      2. A Practical Example
      3. The Next Step: Object-Oriented Method and Design
        1. Extendibility
        2. Reusability
        3. Reliability
      4. Procedural Paradigm
      5. Object-Oriented Paradigm
      6. Encapsulation
      7. Inheritance
      8. Polymorphism
      9. How to Design for Object-Oriented Languages
    23. 20. Development
      1. Introduction
      2. Development Life Cycle
        1. Analysis Phase
        2. Development Phase
        3. Test Phase
      3. SCCS - Source Code Control System
        1. SCCS Revision Versioning
      4. SCCS Commands
        1. Admin Command
        2. get Command
        3. SCCS Command
        4. unget Command
        5. delta Command
      5. Manual Pages of Some Commands Used in Chapter 20
        1. sccs
    24. 21. Introduction to C and C++
      1. Introduction
      2. C andC++ - The History
      3. C and C++ - Compilers
        1. Compiling Programs
        2. Compiler Options
      4. C and C++ - Make Utility
        1. Makefiles
        2. Targets and Dependencies
        3. Library Targets
        4. Rule Targets
        5. Macros
        6. Running make from the Command Line
          1. Comman Line Options For make
      5. C and C++ - Debugging
      6. Manual Pages of Some Commands Used in Chapter 21
        1. make
    25. 22. C Programming Basics
      1. Introduction
      2. Format of a C Program
      3. Good Programming Practices
        1. Comments
      4. Uppercase and Lowercase
      5. C Language Nuts and Bolts
        1. Standard Library
        2. Constants
        3. Symbolic Constants
        4. Escape Sequences
        5. Data Types
        6. Integer
        7. Floating Point
        8. Double Precision
        9. Exponential Notation
        10. Character
        11. Void
      6. Arithmetic Expressions
        1. Increment and Decrement Operators
        2. Assignment Operators
        3. Type Conversion
        4. Precedence
      7. Looping
        1. For Loops
        2. While Loops
        3. Do While Loops
        4. Break Statement
        5. Continue Statement
        6. Logical Operators
        7. Nested Loops
      8. Choice
        1. The if Statement
        2. The if...else Statement
        3. Nested if and if...else and else if Statements
        4. Logical Operators
        5. The switch Statement
      9. Functions
        1. Function Call
        2. Defining a Function
        3. Prototypes
      10. Arrays
        1. Multidimensional Arrays
        2. Passing Arrays to Functions
      11. Strings
      12. Structures
      13. Pointers
        1. Pointer Operators
        2. Pointers and Structures
        3. Pointers and Functions
      14. More Data Types
        1. Storage Classes
        2. Automatic Storage Class
        3. Static Storage Class
        4. Typedef
        5. Enumerations
      15. Dynamic Memory Allocation
    26. 23. C++ Programming Basics
      1. Introduction
      2. C++ Basics
      3. Enhancements
        1. Comments
        2. I/O System
        3. Output Statement
        4. Input Statement
        5. Headers
        6. Enumerations
        7. Precedence
      4. New Features of C++
        1. Namespace
        2. More Data Types and Operators
          1. Access Modifiers
          2. Dynamic Memory Allocation
          3. Function Overloading
          4. Default Function Arguments
        3. Classes
          1. Constructor
          2. Destructor
          3. Friend Functions
        4. String Objects
          1. Declaring a String Object
          2. String Assignment
          3. Concatenation
          4. Comparison
        5. Inheritance
        6. Access Control
        7. Polymorphism
          1. Base Class Pointers
          2. Virtual Functions
        8. Casting Operators
          1. dynamic_cast
          2. const_cast
          3. static_cast
          4. reinterpret_cast
        9. Exception Handling
    27. 24. Internet Programming Basics
      1. Introduction
      2. Internet Basics
      3. History
      4. Client-Server Model of the Internet
      5. Protocols
        1. TCP/IP
        2. HTTP
        3. HTTPS
      6. Web Browsers
    28. 25. Java
      1. Introduction
      2. Architecture Independence
      3. The Java Platform
        1. Dynamic
      4. Java vs. C and C++
      5. Java Environment
        1. Name Space
      6. Comments
      7. No Preprocessor
      8. Constants
      9. No Macros
      10. No Include Files
      11. Data Types
      12. Integral Types
      13. Reference Data Types
      14. Modifiers
      15. No Pointers
      16. Null
      17. No Structure or Unions
      18. No Enumerated Types
      19. No Typedef
      20. Object Creation
      21. Accessing Objects
      22. Garbage Collection
      23. Arrays
      24. Strings
      25. The for Loop
      26. Exception and Exception Handling
      27. Applets
        1. Creating a First Applet
        2. Importing Classes and Packages
        3. Defining Applet Subclass
        4. Applets as Graphical User Interfaces
    29. 26. Perl: An Introduction
      1. Practical Extraction and Reporting Language
      2. Perl Options
      3. Opening Input and Output Files, File Test Operators, and Escape Squences
      4. Variables - Scalar and Array
      5. Conditional Statements and Loops, Operators, and Autoincrement and Autodecrement
      6. Arguments to Shell Programs
      7. Search and Replace
      8. List Operators
      9. Subroutines
    30. 27. The X Window System
      1. X Window System Background
      2. X Server Software
    31. 28. Networking - UNIX and Windows Interoperability
      1. NFS and X Windows
      2. TCP/IP Networking Background
        1. Physical Layer
        2. Link Layer
        3. Network Layer
        4. Transport Layer
        5. Internet Protocol (IP) Addressing
      3. NFS Background
      4. Using Windows and UNIX Networking
      5. File Transfer Protocol (FTP)
      6. Other Connection Topics
    32. 29. Advanced Server for UNIX
      1. Windows Functionality on UNIX
      2. Installing Advanced Server/9000 on UNIX
      3. Sharing a Printer
      4. Sharing a File System
    33. 30. The Windows Command Line: NET Commands, POSIX Utilities, and Others
      1. Introduction for UNIX System Administrators
      2. The Windows Command Line
      3. NET Commands
        1. NET ACCOUNTS
        2. NET COMPUTER
        3. NET CONFIG SERVER
        4. NET CONTINUE
        5. NET FILE
        6. NET GROUP
        7. NET HELP
        8. NET HELPMSG
        9. NET LOCALGROUP
        10. NET NAME
        11. NET PAUSE
        12. NET PRINT
        13. NET SEND
        14. NET SESSION
        15. NET SHARE
        16. NET START
        17. NET STATISTICS
        18. NET STOP
        19. NET TIME
        20. NET USE
        21. NET USER
        22. NET VIEW
        23. POSIX Utilities
        24. cat
        25. chmod
        26. cp
        27. find
        28. grep
        29. ls
        30. mkdir
        31. mv
        32. rm
        33. touch
      4. wc
      5. Additional Commands
        1. Networking Commands
        2. arp
        3. ipconfig
        4. netstat
        5. ping
        6. Permissions with cacls
        7. Command-Line Backup
        8. NTBACKUP
        9. AT
    34. 31. Services for UNIX (SFU)
      1. Introduction to SFU
      2. Using the Network File System (NFS) Functionality of SFU
      3. Telnet Client
      4. Telnet Server
      5. UNIX Utilities
      6. NFS Server
      7. Password Synchronization
    35. 32. Samba
      1. Samba Overview
        1. Setup
        2. Using Shares
      2. Additional Samba Topics
        1. Samba Web Configuration Tool (SWAT)
        2. Log Files
        3. File Name Mangling
        4. User Issues
        5. Samba Utilities and Programs
        6. Obtaining Samba