O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Beginning the Linux Command Line, Second edition

Book Description

This is Linux for those of us who don’t mind typing. All Linux users and administrators tend to like the flexibility and speed of Linux administration from the command line in byte–sized chunks, instead of fairly standard graphical user interfaces. Beginning the Linux Command Line is verified against all of the most important Linux distributions, and follows a task–oriented approach which is distribution agnostic. Now this Second Edition of Beginning the Linux Command Line updates to the very latest versions of the Linux Operating System, including the new Btrfs file system and its management, and systemd boot procedure and firewall management with firewalld!

  • Updated to the latest versions of Linux
  • Work with files and directories, including Btrfs!
  • Administer users and security, and deploy firewalld
  • Understand how Linux is organized, to think Linux!
  • Table of Contents

    1. Cover
    2. Title
    3. Copyright
    4. Dedication
    5. Contents at a Glance
    6. Contents
    7. About the Author
    8. Introduction
    9. Chapter 1: Starting Linux Command-Line Administration
      1. Linux Distributions
        1. Linux History
        2. Open Source
        3. The First Distributions
        4. Linux Turning Mainstream
      2. Logging In and Out
        1. Different Login Interfaces
        2. Working with a User Account
      3. Command-Line Basics
        1. Bash: The Command Interpreter
        2. Commands, Options, and Arguments
      4. Piping and Redirection
        1. Piping
        2. Redirection
      5. Getting Help
        1. Using man to Get Help
        2. Using the --help Option
        3. Getting Information on Installed Packages
      6. Working with the Shell
        1. Using the Shell to Best Effect
        2. Managing Bash with Key Sequences
      7. Summary
    10. Chapter 2: Performing Essential Command-Line tasks
      1. Changing Your Password
      2. Working with Virtual Consoles
      3. Becoming Another User
      4. Obtaining Information About Other Users
      5. Communicating with Other Users
        1. Real-Time Communication
        2. Sending Mail from the Command Line
      6. Finding Your Way in the File System
        1. Default Directories
      7. Working with the Linux File System
        1. Working with Directories
        2. Working with Files
      8. Cool Commands
        1. Displaying a Calendar with cal
        2. Clearing Your Screen with clear
        3. Displaying System Information with uname and hostname
        4. Counting Words, Lines, and Characters with wc
        5. Changing and Showing Date and Time with date
      9. Summary
    11. Chapter 3: Administering the Linux File System
      1. Mounting Disks
        1. Using the mount Command
        2. Unmounting Devices
        3. Automating Mounts with /etc/fstab
      2. Checking File System Integrity
      3. Creating Backups
        1. Making File Backups with tar
        2. Making Device Backups Using dd
      4. Working with Links
        1. Why Use Links?
        2. Working with Symbolic Links
        3. Working with Hard Links
      5. Links Recap
      6. Summary
    12. Chapter 4: Working with Text Files
      1. Working with Vi
        1. Vi Modes
        2. Saving and Quitting
        3. Cutting, Copying, and Pasting
        4. Deleting Text
        5. Moving Through Text Files
        6. Changing All Occurrences of a String in a Text File
        7. Vi Summarized
      2. Displaying Contents of Text Files
        1. Showing File Contents with cat and tac
        2. Showing a File’s Last Lines with tail
        3. Displaying the First Lines in a File with head
        4. Browsing File Contents with less and more
      3. Cool Text File Manipulation Tools
        1. Changing Contents in a Batch with tr
        2. Sorting Text Files with sort
        3. Finding Differences Between Text Files with diff
        4. Checking Whether a Line Exists Twice with uniq
        5. Getting Specific Information with cut
      4. Advanced Text File Filtering and Processing
        1. Working with Basic Regular Expressions
        2. Working with Programmable Filters
      5. Printing Files
        1. Managing CUPS Print Queues
      6. Finding Files
      7. Summary
    13. Chapter 5: Managing Partitions and Logical Volumes
      1. Addressing Storage Devices
        1. File System Labels
        2. udev Device Names
        3. Working with UUID
      2. Creating Partitions
        1. Understanding Partitions
        2. Understanding MBR and GPT Disks
        3. Creating MBR Partitions
        4. Managing Partitions with fdisk
        5. Creating Partitions
        6. Creating GPT Partitions with gdisk
        7. Working with cfdisk
        8. Recovering Lost Partitions with gpart
      3. Creating Logical Volumes
        1. Understanding Logical Volumes
        2. Setting Up a Disk with Logical Volume Manager
        3. Creating Physical Volumes
        4. Creating Volume Groups
        5. Creating Logical Volumes
        6. Working with Snapshots
        7. Basic LVM Troubleshooting
      4. Working with File Systems
        1. Understanding File Systems
        2. About Superblocks, Inode Bitmaps, and Block Bitmaps
        3. Journaling
        4. Indexing
        5. Btrfs
        6. Formatting File Systems
        7. Maintaining File Systems
        8. Analyzing and Repairing Ext
        9. Analyzing and Repairing XFS File Systems
        10. Resizing File Systems
        11. Resizing a File System in a Logical Volume
        12. Resizing Partitions with GParted
        13. Working with Windows File Systems
      5. Cloning Devices
      6. Summary
    14. Chapter 6: Managing Users and Groups
      1. Setting Up User Accounts
        1. Understanding Users and Their Properties
        2. Commands for User Management
        3. Working with Default Values for User Management
      2. Managing Passwords
        1. Performing Account Maintenance with passwd
        2. Managing Password Expiration
        3. Behind the Commands: Configuration Files
      3. Group Membership
        1. Creating Groups
        2. The Use of Group Passwords
      4. Managing the User’s Shell Environment
        1. Creating Shell Login Scripts
        2. Showing Messages to Users Logging In
      5. Applying Quota to Allow a Maximum Amount of Files
        1. Installing the Quota Software
        2. Preparing the File System for Quota
        3. Initializing Quota
        4. Setting Quota for Users and Groups
      6. Techniques Behind Authentication
        1. Understanding Pluggable Authentication Modules
        2. Discovering PAM Modules
        3. The role of /etc/nsswitch.conf
      7. Configuring Administrator Tasks with sudo
      8. Summary
    15. Chapter 7: Managing Permissions
      1. Setting Ownership
        1. Displaying Ownership
        2. Changing User Ownership
        3. Changing Group Ownership
        4. Default Ownership
      2. Basic Permissions: Read, Write, and Execute
        1. Understanding Read, Write, and Execute Permissions
        2. Applying Read, Write, and Execute Permissions
      3. Advanced Permissions
        1. Understanding Advanced Permissions
        2. Applying Advanced Permissions
      4. Working with Access Control Lists
        1. Understanding ACLs
        2. Preparing Your File System for ACLs
        3. Changing and Viewing ACL Settings with setfacl and getfacl
      5. Setting Default Permissions with umask
      6. Working with Attributes
      7. Summary
    16. Chapter 8: Managing Software
      1. Understanding Software Management
      2. Managing RPM Packages
        1. Working with RPM
        2. Working with yum
        3. Working with zypper
      3. Managing DEB Packages
        1. Managing .deb Software Repositories
        2. Ubuntu Package Management Utilities
      4. Summary
    17. Chapter 9: Process and System Management
      1. Understanding Linux Processes
      2. Monitoring Processes
        1. Monitoring Processes with top
        2. Finding Processes with ps
        3. Finding PIDs with pgrep
        4. Showing Parent-Child Relations with pstree
      3. Managing Processes
        1. Adjusting Process Priority with nice
        2. Process Management from top
      4. Scheduling Processes
        1. Creating user crontabs
        2. Understanding cron.{hourly|daily|weekly|monthly}
        3. Using /etc/cron.d
      5. Summary
    18. Chapter 10: System Logging
      1. Understanding Logging
      2. Monitoring Files in /var/log
      3. Configuring the syslog Service
      4. Configuring syslog-ng
      5. Sending Logs Yourself with logger
      6. Rotating Old Log Files
      7. Understanding Journald
      8. Summary
    19. Chapter 11: Configuring the Network
      1. A Quick Introduction to Computer Networking
      2. Understanding Network Device Naming
      3. Setting the IP Address
        1. Using the ip Tool
        2. Using ifconfig
        3. Using Virtual Ip addresses with ifconfig
      4. Storing Address Configuration
        1. Storing IP Address Configuration on Ubuntu
        2. Storing IP Address Configuration on Red Hat
        3. Storing IP Address Configuration on SUSE
      5. Configuring Routing
        1. Managing the Default Route with route
        2. Managing the Default Route with the ip Tool
        3. Storing Routing Information
      6. Resolving DNS Names to IP Addresses
        1. The Role of the /etc/nsswitch.conf File
        2. Using the /etc/hosts File
      7. Tuning the Network Card with ethtool
      8. Analyzing Network Connections
        1. Testing Connectivity
        2. Testing Routing
        3. Testing Availability of Services
      9. Connecting Remotely with Secure Shell
        1. Working with Public/Private Key Pairs
        2. Working with Secure Shell
      10. Configuring SSH
        1. Using SSH Key-Based Authentication
        2. Caching Keys with ssh- ssh-agent
        3. Tunneling Traffic with SSH
      11. Summary
    20. Chapter 12: Configuring a File Server
      1. Operating File Servers Securely
      2. Creating a Samba File Server
        1. Background of the Samba Project
        2. Configuring a Samba File Server
        3. Accessing a Samba File Server
        4. Basic Samba Troubleshooting
      3. Configuring an NFS Server
        1. NFS Backgrounds
        2. Understanding NFS Processes
        3. Configuring an NFS Server
        4. Configuring an NFS Client
      4. Summary
    21. Chapter 13: Working with the Kernel
      1. Understanding the Kernel
      2. Managing Kernel Modules
        1. Listing Modules with lsmod
        2. Loading and Unloading Modules with modprobe
        3. Displaying Module Properties with modinfo
        4. Changing Module Options
        5. Managing Module Dependencies
        6. Legacy Commands for Module Management
      3. Tuning Kernel Parameters
        1. Writing Changes to /proc
        2. Some Useful /proc Parameters
      4. Compiling Your Own Kernel and Kernel Modules
        1. Understanding Make
        2. Modifying and Compiling the Kernel
        3. Compiling Modules
      5. Managing the Grub2 Bootloader
      6. Summary
    22. Chapter 14: Introduction to Bash Shell Scripting
      1. Basic Shell Script Components
        1. Elements of a Good Shell Script
        2. Executing the Script
      2. Working with Variables and Input
        1. Understanding Variables
        2. Variables, Subshells, and Sourcing
        3. Working with Script Arguments
        4. Asking for Input
        5. Using Command Substitution
        6. Substitution Operators
        7. Changing Variable Content with Pattern Matching
        8. Performing Calculations
      3. Using Control Structures
        1. Using if ... then ... else
        2. Case
        3. Using while
        4. Using until
        5. Using for
      4. Summary
    23. Appendix A: Installing Linux
      1. Installation Requirements
        1. Installing CentOS
        2. Installing Ubuntu Server
    24. Index