Advanced
Searching inSummaries
How to search
  • Words find lesson titles, text and code. Filter by type (guides, courses, programs, books) or stay in this book.
  • book:rhcsa and ch:8 narrow the search; #code finds a word only in commands of the lessons.
  • "two words" finds the exact phrase.
  • Plain words find names, texts and examples.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search
Try:

The Linux Command Line

A complete course on the Linux shell, from the first command to real shell scripts. 36 chapters in 4 parts: learn the shell, set up your environment, use the essential tools (packages, disks, network, find, backups, regular expressions, text processing), and write scripts with functions, loops, options and arrays. Each chapter here has short lessons with examples and review questions, and each part ends with a hands-on lab.

Book by
William Shotts
linuxcommand.org
2026
Lessons
321

These summaries are written in my own words to help me learn. They are not a copy of the book. Buy the book for the full text.

Parts and chapters

Part 1

Learning the shell

Learning the Shell

  1. 1Meet the shell and the terminalWhat Is the Shell?8 lessons
    Lessons
    1. 1.1 Know what the shell and the terminal are
    2. 1.2 Read the prompt
    3. 1.3 Type your first keystrokes
    4. 1.4 Use the history and the arrow keys
    5. 1.5 Copy and paste with the mouse
    6. 1.6 End the session
    7. 1.7 Find the virtual consoles
    8. 1.8 Summary of the chapter
  2. 2Move around the filesystemNavigation8 lessons
    Lessons
    1. 2.1 Understand the filesystem tree
    2. 2.2 Find where you are with pwd
    3. 2.3 List the contents with ls
    4. 2.4 Change the directory with cd
    5. 2.5 Use absolute and relative pathnames
    6. 2.6 Use the cd shortcuts
    7. 2.7 Follow the rules for file names
    8. 2.8 Summary of the chapter
  3. 3Look around the systemExploring the System9 lessons
    Lessons
    1. 3.1 Use options and arguments
    2. 3.2 Know the most useful ls options
    3. 3.3 Read the long format
    4. 3.4 Find out the file type with file
    5. 3.5 Read text files with less
    6. 3.6 Take a tour of the system directories
    7. 3.7 Understand symbolic links
    8. 3.8 Understand hard links
    9. 3.9 Summary of the chapter
  4. 4Copy, move, delete and link filesManipulating Files and Directories8 lessons
    Lessons
    1. 4.1 Select many files with wildcards
    2. 4.2 Make directories with mkdir
    3. 4.3 Copy files with cp
    4. 4.4 Move and rename with mv
    5. 4.5 Delete with rm
    6. 4.6 Make links with ln
    7. 4.7 Build a playground
    8. 4.8 Summary of the chapter
  5. 5Know your commands and find helpWorking with Commands10 lessons
    Lessons
    1. 5.1 Know the four kinds of commands
    2. 5.2 Find the kind with type
    3. 5.3 Find the program file with which
    4. 5.4 Get help for builtins with help
    5. 5.5 Use --help for programs
    6. 5.6 Read the manual with man
    7. 5.7 Search the manual with apropos and whatis
    8. 5.8 Read info pages and README files
    9. 5.9 Make your own commands with alias
    10. 5.10 Summary of the chapter
  6. 6Redirect input and output, build pipelinesRedirection10 lessons
    Lessons
    1. 6.1 Know stdin, stdout and stderr
    2. 6.2 Send output to a file
    3. 6.3 Send errors to a file
    4. 6.4 Send output and errors to the same file
    5. 6.5 Throw away output with /dev/null
    6. 6.6 Read input from a file
    7. 6.7 Join commands with pipelines
    8. 6.8 Use filters in a pipeline
    9. 6.9 Save and see at the same time with tee
    10. 6.10 Summary of the chapter
  7. 7How the shell reads your line (expansion and quoting)Seeing the World as the Shell Sees It11 lessons
    Lessons
    1. 7.1 See expansion with echo
    2. 7.2 Pathname expansion
    3. 7.3 Tilde expansion
    4. 7.4 Arithmetic expansion
    5. 7.5 Brace expansion
    6. 7.6 Parameter expansion
    7. 7.7 Command substitution
    8. 7.8 Control expansion with double quotes
    9. 7.9 Stop all expansion with single quotes and the backslash
    10. 7.10 Use backslash escape sequences
    11. 7.11 Summary of the chapter
  8. 8Work faster with the keyboardAdvanced Keyboard Tricks9 lessons
    Lessons
    1. 8.1 Move the cursor
    2. 8.2 Change text
    3. 8.3 Cut and paste (kill and yank)
    4. 8.4 Complete names with Tab
    5. 8.5 Use the history
    6. 8.6 Search the history with Ctrl-r
    7. 8.7 Use history expansion
    8. 8.8 Record a session with script
    9. 8.9 Summary of the chapter
  9. 9Permissions and usersPermissions11 lessons
    Lessons
    1. 9.1 Know owners, groups and the world
    2. 9.2 Read the rights: r, w, x
    3. 9.3 Change rights with chmod (octal)
    4. 9.4 Change rights with chmod (symbols)
    5. 9.5 Set default rights with umask
    6. 9.6 Use the special bits
    7. 9.7 Become another user with su
    8. 9.8 Run a command as root with sudo
    9. 9.9 Change owner and group with chown and chgrp
    10. 9.10 Share a folder and change passwords
    11. 9.11 Summary of the chapter
  10. 10See and control processesProcesses10 lessons
    Lessons
    1. 10.1 Know how processes start
    2. 10.2 List processes with ps
    3. 10.3 Watch processes live with top
    4. 10.4 Stop, background and foreground
    5. 10.5 Change the priority with nice and renice
    6. 10.6 Send signals with kill
    7. 10.7 Signal many processes with killall
    8. 10.8 Shut down the system
    9. 10.9 Use more process tools
    10. 10.10 Summary of the chapter

Part 2

Configuration and the environment

Configuration and the Environment

  1. 11Set up the environmentThe Environment10 lessons
    Lessons
    1. 11.1 Know what is in the environment
    2. 11.2 Know the important variables
    3. 11.3 Know how the environment is built
    4. 11.4 Read a startup file
    5. 11.5 Know how child processes inherit
    6. 11.6 Start a program with a temporary variable
    7. 11.7 Change the environment so it stays
    8. 11.8 Edit files with a text editor
    9. 11.9 Activate the changes with source
    10. 11.10 Summary of the chapter
  2. 12Edit text with vi and vimA Gentle Introduction to vi(m)10 lessons
    Lessons
    1. 12.1 Know why vi is worth learning
    2. 12.2 Start and quit vi
    3. 12.3 Understand the modes
    4. 12.4 Enter insert mode
    5. 12.5 Move the cursor
    6. 12.6 Delete, cut, copy and paste
    7. 12.7 Search and replace
    8. 12.8 Work with many files
    9. 12.9 Use vi keys in bash
    10. 12.10 Summary of the chapter
  3. 13Customize the promptCustomizing the Prompt6 lessons
    Lessons
    1. 13.1 Read the parts of PS1
    2. 13.2 Try new prompt designs
    3. 13.3 Add colour
    4. 13.4 Move the cursor
    5. 13.5 Keep the new prompt
    6. 13.6 Summary of the chapter

Part 3

Common tasks and essential tools

Common Tasks and Essential Tools

  1. 14Install and manage software packagesPackage Management10 lessons
    Lessons
    1. 14.1 Know the two package families
    2. 14.2 Understand packages, repositories and dependencies
    3. 14.3 Find a package
    4. 14.4 Install a package
    5. 14.5 Remove a package
    6. 14.6 Update the system
    7. 14.7 Ask questions about packages
    8. 14.8 Know the universal package formats
    9. 14.9 Know the "hard to install" myth
    10. 14.10 Summary of the chapter
  2. 15Work with disks and storage mediaStorage Media10 lessons
    Lessons
    1. 15.1 Mount and unmount filesystems
    2. 15.2 List mounted filesystems
    3. 15.3 Mount by hand
    4. 15.4 Know why unmounting is important
    5. 15.5 Find the device names
    6. 15.6 Make partitions and filesystems
    7. 15.7 Test and repair filesystems with fsck
    8. 15.8 Copy raw data with dd
    9. 15.9 Make, mount and check ISO images
    10. 15.10 Summary of the chapter
  3. 16Use the network from the command lineNetworking9 lessons
    Lessons
    1. 16.1 Check a host with ping
    2. 16.2 Follow the route with traceroute
    3. 16.3 See interfaces and routes with ip
    4. 16.4 Move files with ftp and lftp
    5. 16.5 Download with curl and wget
    6. 16.6 Log in safely with ssh
    7. 16.7 Make an SSH tunnel
    8. 16.8 Copy files with scp and sftp
    9. 16.9 Summary of the chapter
  4. 17Find files with locate and findSearching for Files9 lessons
    Lessons
    1. 17.1 Find files fast with locate
    2. 17.2 Search the real files with find
    3. 17.3 Use the find tests
    4. 17.4 Combine tests with operators
    5. 17.5 Run actions on the results
    6. 17.6 Pass results to xargs
    7. 17.7 Practise in a playground
    8. 17.8 Use the find options
    9. 17.9 Summary of the chapter
  5. 18Archive, compress and back upArchiving and Backup9 lessons
    Lessons
    1. 18.1 Compress files with gzip
    2. 18.2 Use bzip2 and xz
    3. 18.3 Make archives with tar
    4. 18.4 Compress tar archives
    5. 18.5 Use tar over the network
    6. 18.6 Use zip for Windows users
    7. 18.7 Synchronize with rsync
    8. 18.8 Use rsync over the network
    9. 18.9 Summary of the chapter
  6. 19Regular expressionsRegular Expressions12 lessons
    Lessons
    1. 19.1 Know what a regex is
    2. 19.2 Search with grep
    3. 19.3 Use literals and metacharacters
    4. 19.4 Match any character with the dot
    5. 19.5 Use anchors
    6. 19.6 Solve a crossword with a regex
    7. 19.7 Use bracket expressions
    8. 19.8 Use POSIX character classes
    9. 19.9 Use alternation and groups
    10. 19.10 Use quantifiers
    11. 19.11 Put regex to work
    12. 19.12 Summary of the chapter
  7. 20Process textText Processing13 lessons
    Lessons
    1. 20.1 Know where text is used
    2. 20.2 Look closer with cat
    3. 20.3 Sort lines with sort
    4. 20.4 Report repeated lines with uniq
    5. 20.5 Cut columns with cut
    6. 20.6 Put lines together with paste and join
    7. 20.7 Reverse lines and characters with tac and rev
    8. 20.8 Compare files with comm and diff
    9. 20.9 Apply changes with patch
    10. 20.10 Change characters with tr
    11. 20.11 Edit text in a stream with sed
    12. 20.12 Check spelling with aspell
    13. 20.13 Summary of the chapter
  8. 21Format outputFormatting Output7 lessons
    Lessons
    1. 21.1 Number lines with nl
    2. 21.2 Wrap lines with fold
    3. 21.3 Format paragraphs with fmt
    4. 21.4 Paginate text with pr
    5. 21.5 Format data with printf
    6. 21.6 Make documents with groff
    7. 21.7 Summary of the chapter
  9. 22Print from the command linePrinting6 lessons
    Lessons
    1. 22.1 Know the short history
    2. 22.2 Prepare text with pr
    3. 22.3 Send jobs with lpr and lp
    4. 22.4 Make pretty pages with a2ps
    5. 22.5 Watch and cancel print jobs
    6. 22.6 Summary of the chapter
  10. 23Compile programs from sourceCompiling Programs8 lessons
    Lessons
    1. 23.1 Know what compiling is
    2. 23.2 Install the build tools
    3. 23.3 Get the source code
    4. 23.4 Look at the source tree
    5. 23.5 Run configure
    6. 23.6 Build with make
    7. 23.7 Install the program
    8. 23.8 Summary of the chapter

Part 4

Writing shell scripts

Writing Shell Scripts

  1. 24Write your first scriptWriting Your First Script7 lessons
    Lessons
    1. 24.1 Know what a shell script is
    2. 24.2 Write the script file
    3. 24.3 Make it executable
    4. 24.4 Put it in the PATH
    5. 24.5 Write scripts that are easy to read
    6. 24.6 Set up vim for scripts
    7. 24.7 Summary of the chapter
  2. 25Start a project: an HTML report scriptStarting a Project6 lessons
    Lessons
    1. 25.1 Make a minimal document
    2. 25.2 Add data with variables
    3. 25.3 Know the rules for variables and constants
    4. 25.4 Assign values to variables
    5. 25.5 Use here documents
    6. 25.6 Summary of the chapter
  3. 26Top-down design with functionsTop-Down Design7 lessons
    Lessons
    1. 26.1 Think top-down
    2. 26.2 Write shell functions
    3. 26.3 Use local variables
    4. 26.4 Keep the script running: stubs
    5. 26.5 Fill in the functions
    6. 26.6 Put functions in .bashrc
    7. 26.7 Summary of the chapter
  4. 27Make decisions with ifFlow Control: Branching with if11 lessons
    Lessons
    1. 27.1 Write an if statement
    2. 27.2 Understand the exit status
    3. 27.3 Test files
    4. 27.4 Test strings
    5. 27.5 Test integers
    6. 27.6 Use the modern [[ ]]
    7. 27.7 Use (( )) for numbers
    8. 27.8 Combine conditions
    9. 27.9 Branch with && and ||
    10. 27.10 Finish the report: check for root
    11. 27.11 Summary of the chapter
  5. 28Read keyboard inputReading Keyboard Input8 lessons
    Lessons
    1. 28.1 Read a value with read
    2. 28.2 Read several values
    3. 28.3 Use the read options
    4. 28.4 Split input with IFS
    5. 28.5 Know why you cannot pipe into read
    6. 28.6 Check the input
    7. 28.7 Build a menu
    8. 28.8 Summary of the chapter
  6. 29Loop with while and untilFlow Control: Looping with while / until8 lessons
    Lessons
    1. 29.1 Know what a loop is
    2. 29.2 Repeat with while
    3. 29.3 Make the menu repeat
    4. 29.4 Stop or skip with break and continue
    5. 29.5 Build a menu with select
    6. 29.6 Repeat with until
    7. 29.7 Read a file with a loop
    8. 29.8 Summary of the chapter
  7. 30Find and fix errors in scriptsTroubleshooting13 lessons
    Lessons
    1. 30.1 Fix missing quotes
    2. 30.2 Fix missing or unexpected tokens
    3. 30.3 Watch for unexpected expansions
    4. 30.4 Know the logic errors
    5. 30.5 Program defensively
    6. 30.6 Know set -e, set -u and pipefail
    7. 30.7 Check scripts with ShellCheck
    8. 30.8 Watch out for file names
    9. 30.9 Check all input
    10. 30.10 Test with test cases
    11. 30.11 Debug: find the area and trace
    12. 30.12 Look at values while the script runs
    13. 30.13 Summary of the chapter
  8. 31Choose with caseFlow Control: Branching with case5 lessons
    Lessons
    1. 31.1 Write a case statement
    2. 31.2 Use patterns
    3. 31.3 Combine patterns with |
    4. 31.4 Run more than one match with ;;&
    5. 31.5 Summary of the chapter
  9. 32Positional parameters and optionsPositional Parameters9 lessons
    Lessons
    1. 32.1 Read the command line
    2. 32.2 Count the arguments with $#
    3. 32.3 Walk through the arguments with shift
    4. 32.4 Write a simple tool
    5. 32.5 Use parameters in functions
    6. 32.6 Handle all parameters with $@ and $*
    7. 32.7 Add options to the report script
    8. 32.8 Use getopts for short options
    9. 32.9 Summary of the chapter
  10. 33Loop with forFlow Control: Looping with for7 lessons
    Lessons
    1. 33.1 Use the traditional form
    2. 33.2 Loop over files safely
    3. 33.3 Find the longest word
    4. 33.4 Use the C language form
    5. 33.5 Add a loop to the report
    6. 33.6 Use for in daily admin work
    7. 33.7 Summary of the chapter
  11. 34Work with strings and numbersStrings and Numbers8 lessons
    Lessons
    1. 34.1 Use basic parameters
    2. 34.2 Handle empty variables
    3. 34.3 Find variable names
    4. 34.4 Measure, cut and change strings
    5. 34.5 Change upper and lower case
    6. 34.6 Calculate with $(( ))
    7. 34.7 Calculate decimals with bc
    8. 34.8 Summary of the chapter
  12. 35Use arraysArrays11 lessons
    Lessons
    1. 35.1 Know what arrays are
    2. 35.2 Make an array
    3. 35.3 Use an array: count files by hour
    4. 35.4 Print all elements
    5. 35.5 Count elements and find the indexes
    6. 35.6 Fill arrays with read -a and +=
    7. 35.7 Read a file into an array
    8. 35.8 Slice and sort arrays
    9. 35.9 Delete arrays and elements
    10. 35.10 Use associative arrays
    11. 35.11 Summary of the chapter
  13. 36Exotica: advanced tricksExotica8 lessons
    Lessons
    1. 36.1 Use group commands and subshells
    2. 36.2 Use process substitution
    3. 36.3 Build commands with eval
    4. 36.4 Catch signals with trap
    5. 36.5 Make temporary files safely
    6. 36.6 Run jobs at the same time with wait
    7. 36.7 Use named pipes
    8. 36.8 Summary of the book

Exam objectives

Every RHCSA exam objective and the lesson where you learn it.

Part 1 — Learning the shell

Part 2 — Configuration and the environment

Part 3 — Common tasks and essential tools

Part 4 — Writing shell scripts