You are previewing BSD Unix® Toolbox: 1000+ Commands for FreeBSD®, OpenBSD, and NetBSD®.
O'Reilly logo
BSD Unix® Toolbox: 1000+ Commands for FreeBSD®, OpenBSD, and NetBSD®

Book Description

This handy, compact guide teaches you to use BSD UNIX systems as the experts do: from the command line. Try out more than 1,000 commands to find and get software, monitor system health and security, and access network resources. Apply the skills you learn from this book to use and administer servers and desktops running FreeBSD, OpenBSD, NetBSD, or any other BSD flavor.

Expand your BSD UNIX expertise in these and other areas:

  • Using the shell

  • Finding online software

  • Working with files

  • Playing with music and images

  • Administering file systems

  • Backing up data

  • Checking and managing running processes

  • Accessing network resources

  • Handling remote system administration

  • Locking down security

  • Table of Contents

    1. Copyright
    2. About the Authors
    3. About the Technical Editor
    4. Credits
    5. Acknowledgments
    6. Introduction
      1. Who Should Read This Book
      2. What This Book Covers
      3. How This Book Is Structured
      4. What You Need to Use This Book
      5. Conventions
    7. 1. Starting with BSD Systems
      1. 1.1. About FreeBSD, NetBSD, and OpenBSD
        1. 1.1.1. Finding BSD Resources
      2. 1.2. Focusing on BSD Commands
        1. 1.2.1. Finding Commands
        2. 1.2.2. Command Reference Information in BSD
      3. 1.3. Summary
    8. 2. Installing FreeBSD and Adding Software
      1. 2.1. Before Installing FreeBSD
      2. 2.2. Installing FreeBSD
        1. 2.2.1. Booting the Install Disc
        2. 2.2.2. Starting the Install Process
      3. 2.3. Adding, Deleting, and Managing Software
        1. 2.3.1. Finding Software
        2. 2.3.2. Installing Software Packages (binary)
        3. 2.3.3. Removing Software Packages (binary)
        4. 2.3.4. Installing Software Using Ports (source code)
        5. 2.3.5. Getting the Ports Collection
        6. 2.3.6. Getting and Installing Applications with Ports
      4. 2.4. Checking Packages and Ports
        1. 2.4.1. Checking Installed Packages Against Ports
        2. 2.4.2. Upgrading Ports
        3. 2.4.3. Auditing Installed Packages
        4. 2.4.4. Cleaning Up the Ports Collection
      5. 2.5. Summary
    9. 3. Using the Shell
      1. 3.1. Terminal Windows and Shell Access
        1. 3.1.1. Using Terminal Windows
        2. 3.1.2. Using Virtual Terminals
      2. 3.2. Using the Shell
        1. 3.2.1. Using Bash History
        2. 3.2.2. Using Command Line Completion
        3. 3.2.3. Redirecting stdin and stdout
        4. 3.2.4. Using aliases
        5. 3.2.5. Tailing Files
      3. 3.3. Acquiring Super-User Power
        1. 3.3.1. Using the su Command
        2. 3.3.2. Delegating Power with sudo
      4. 3.4. Using Environment Variables
      5. 3.5. Creating Simple Shell Scripts
        1. 3.5.1. Editing and Running a Script
        2. 3.5.2. Adding Content to Your Script
      6. 3.6. Summary
    10. 4. Working with Files
      1. 4.1. Understanding File Types
        1. 4.1.1. Using Regular Files
        2. 4.1.2. Using Directories
        3. 4.1.3. Using Symbolic and Hard Links
        4. 4.1.4. Using Device Files
        5. 4.1.5. Using Named Pipes and Sockets
      2. 4.2. Setting File and Directory Permissions
        1. 4.2.1. Changing Permissions with chmod
        2. 4.2.2. Setting the umask
        3. 4.2.3. Changing Ownership
      3. 4.3. Traversing the File System
      4. 4.4. Copying Files
      5. 4.5. Changing File Attributes
      6. 4.6. Searching for Files
        1. 4.6.1. Generating the locate Database
        2. 4.6.2. Finding Files with locate
        3. 4.6.3. Locating Files with find
        4. 4.6.4. Using Other Commands to Find Files
      7. 4.7. Finding Out More About Files
        1. 4.7.1. Listing Files
        2. 4.7.2. Verifying Files
      8. 4.8. Summary
    11. 5. Manipulating Text
      1. 5.1. Matching Text with Regular Expressions
      2. 5.2. Editing Text Files
        1. 5.2.1. Using the JOE Editor
        2. 5.2.2. Using the Pico and Nano Editors
        3. 5.2.3. Graphical Text Editors
      3. 5.3. Listing, Sorting, and Changing Text
        1. 5.3.1. Listing Text Files
        2. 5.3.2. Paging Through Text
        3. 5.3.3. Paginating Text Files with pr
        4. 5.3.4. Searching for Text with grep
        5. 5.3.5. Replacing Text with sed
        6. 5.3.6. Translate or Remove Characters with tr
        7. 5.3.7. Checking Differences Between Two Files with diff
        8. 5.3.8. Using awk and cut to Process Columns
        9. 5.3.9. Converting Text Files to Different Formats
      4. 5.4. Summary
    12. 6. Playing with Multimedia
      1. 6.1. Working with Audio
        1. 6.1.1. Starting with Audio
        2. 6.1.2. Playing Music
        3. 6.1.3. Adjusting Audio Levels
        4. 6.1.4. Ripping CD Music
        5. 6.1.5. Encoding Music
        6. 6.1.6. Converting Audio Files
      2. 6.2. Transforming Images
        1. 6.2.1. Getting Information about Images
        2. 6.2.2. Converting Images
        3. 6.2.3. Converting Images in Batches
      3. 6.3. Summary
    13. 7. Administering File Systems
      1. 7.1. Understanding File System Basics
        1. 7.1.1. Setting Up the Disk Initially
        2. 7.1.2. Checking Your Disk Setup
        3. 7.1.3. Understanding File System Types
      2. 7.2. Creating and Managing File Systems
        1. 7.2.1. Slicing and Partitioning Hard Disks
        2. 7.2.2. Working with Linux-Compatible File Systems
        3. 7.2.3. Creating a Memory Disk File System
        4. 7.2.4. Creating and Using Swap Partitions
      3. 7.3. Mounting and Unmounting File Systems
        1. 7.3.1. Mounting File Systems from the fstab File
        2. 7.3.2. Mounting File Systems with the mount Command
        3. 7.3.3. Unmounting File Systems with umount
      4. 7.4. Checking File Systems
      5. 7.5. Finding Out About File System Use
      6. 7.6. Summary
    14. 8. Backups and Removable Media
      1. 8.1. Backing Up Data to Compressed Archives
        1. 8.1.1. Creating Backup Archives with tar
        2. 8.1.2. Using Compression Tools
        3. 8.1.3. Listing, Joining, and Adding Files to tar Archives
      2. 8.2. Backing Up Over Networks
        1. 8.2.1. Backing Up tar Archives Over ssh
        2. 8.2.2. Backing Up Files with rsync
        3. 8.2.3. Backing Up with unison
        4. 8.2.4. Backing Up to Removable Media
        5. 8.2.5. Creating Backup Images with mkisofs
        6. 8.2.6. Burning Backup Images with cdrecord
        7. 8.2.7. Making and Burning DVDs with growisofs
      3. 8.3. Summary
    15. 9. Checking and Managing Running Processes
      1. 9.1. Listing Active Processes
        1. 9.1.1. Viewing Active Processes with ps
        2. 9.1.2. Watching Active Processes with top
      2. 9.2. Finding and Controlling Processes
        1. 9.2.1. Using pgrep to Find Processes
        2. 9.2.2. Using fuser to Find Processes
      3. 9.3. Summary
    16. 10. Managing the System
      1. 10.1. Monitoring Resources
        1. 10.1.1. Monitoring Memory Use
        2. 10.1.2. Monitoring CPU Usage
        3. 10.1.3. Monitoring Storage Devices
      2. 10.2. Mastering Time
        1. 10.2.1. Changing Time Zone
        2. 10.2.2. Displaying and Setting Your Time and Date
        3. 10.2.3. Using Network Time Protocol to Set Date/Time
        4. 10.2.4. Checking Uptime
      3. 10.3. Managing the Boot Process
        1. 10.3.1. Using the boot0 Boot Loader
        2. 10.3.2. Using bsdlabel to Check Out Partitions
        3. 10.3.3. Changing to the GRUB boot loader
      4. 10.4. Controlling System Services
      5. 10.5. Starting and Stopping Your System
      6. 10.6. Straight to the Kernel
      7. 10.7. Poking at the Hardware
      8. 10.8. Summary
    17. 11. Managing Network Connections
      1. 11.1. Configuring Network Interfaces Using sysinstall
      2. 11.2. Managing Network Interface Cards
      3. 11.3. Managing Network Connections
        1. 11.3.1. Starting and Stopping Ethernet Connections
        2. 11.3.2. Starting and Stopping Network Services
      4. 11.4. Using Wireless Connections
        1. 11.4.1. Getting Wireless Driver
        2. 11.4.2. Configuring Wireless Interfaces
      5. 11.5. Checking Name Resolution
      6. 11.6. Troubleshooting Network Problems
        1. 11.6.1. Checking Connectivity to a Host
        2. 11.6.2. Checking Address Resolution Protocol (ARP)
        3. 11.6.3. Tracing Routes to Hosts
        4. 11.6.4. Displaying netstat Connections and Statistics
        5. 11.6.5. Other Useful Network Tools
      7. 11.7. Summary
    18. 12. Accessing Network Resources
      1. 12.1. Running Commands to Browse the Web
      2. 12.2. Transferring Files
        1. 12.2.1. Downloading Files with wget
        2. 12.2.2. Transferring Files with cURL
        3. 12.2.3. Transferring Files with FTP Commands
        4. 12.2.4. Using SSH Tools to Transfer Files
        5. 12.2.5. Using Windows File Transfer Tools
      3. 12.3. Sharing Remote Directories
        1. 12.3.1. Sharing Remote Directories with NFS
        2. 12.3.2. Sharing Remote Directories with Samba
        3. 12.3.3. Sharing Remote Directories with SSHFS
      4. 12.4. Chatting with Friends in IRC
      5. 12.5. Using Text-Based e-mail Clients
        1. 12.5.1. Managing e-mail with mail
        2. 12.5.2. Managing e-mail with mutt
      6. 12.6. Summary
    19. 13. Doing Remote System Administration
      1. 13.1. Doing Remote Login and Tunneling with SSH
        1. 13.1.1. Configuring SSH
        2. 13.1.2. Logging in Remotely with ssh
      2. 13.2. Using screen: A Rich Remote Shell
      3. 13.3. Using a Remote Windows Desktop
        1. 13.3.1. Connecting to a Windows Desktop with tsclient
        2. 13.3.2. Connecting to a Windows Desktop with rdesktop
      4. 13.4. Using Remote BSD Desktop and Applications
      5. 13.5. Sharing Desktops Using VNC
        1. 13.5.1. Setting Up the VNC Server
        2. 13.5.2. Starting Up the VNC Client
        3. 13.5.3. Using VNC on Untrusted Networks with SSH
        4. 13.5.4. Sharing a VNC Desktop with Vino
      6. 13.6. Summary
    20. 14. Locking Down Security
      1. 14.1. Working with Users and Groups
        1. 14.1.1. Managing Users the GUI Way
        2. 14.1.2. Adding User Accounts
        3. 14.1.3. Adding Batches of Users
        4. 14.1.4. Setting User Account Defaults
        5. 14.1.5. Using Options When Adding Users
        6. 14.1.6. Using Login Classes
        7. 14.1.7. Modifying User Accounts
        8. 14.1.8. Deleting User Accounts
        9. 14.1.9. Managing Passwords
        10. 14.1.10. Adding Groups
      2. 14.2. Checking on Users
      3. 14.3. Securing Network Services
      4. 14.4. Configuring the Built-In Firewall
      5. 14.5. Working with System Logs
      6. 14.6. Using Advanced Security Features
      7. 14.7. Summary
    21. A. Using vi or Vim Editors
      1. A.1. Starting and Quitting the vi Editor
      2. A.2. Moving Around in vi
      3. A.3. Changing and Deleting Text in vi
      4. A.4. Using Miscellaneous Commands
      5. A.5. Modifying Commands with Numbers
      6. A.6. Using Ex Commands
      7. A.7. Working in Visual Mode
      8. A.8. Summary
    22. B. Shell Special Characters and Variables
      1. B.1. Using Special Shell Characters
      2. B.2. Using Shell Variables
    23. C. Personal Configuration Files