The Linux Command Line

Linux Command Line

A Complete Introduction
by William E. Shotts, Jr.
January 2012, 480 pp.

You've experienced the shiny, point-and-click surface of your Linux computer—now dive below and explore its depths with the power of the command line.

The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.

In addition to that practical knowledge, author William Shotts reveals the philosophy behind these tools and the rich heritage that your desktop Linux machine has inherited from Unix supercomputers of yore.

As you make your way through the book's short, easily-digestible chapters, you'll learn how to:

  • Create and delete files, directories, and symlinks
  • Administer your system, including networking, package installation, and process management
  • Use standard input and output, redirection, and pipelines
  • Edit files with Vi, the world’s most popular text editor
  • Write shell scripts to automate common or boring tasks
  • Slice and dice text files with cut, paste, grep, patch, and sed

Once you overcome your initial "shell shock," you'll find that the command line is a natural and expressive way to communicate with your computer. Just don't be surprised if your mouse starts to gather dust.

A featured resource in the Linux Foundation's "Evolution of a SysAdmin"

Author Bio 

William E. Shotts, Jr. has been a software professional and avid Linux user for more than 15 years. He has an extensive background in software development, including technical support, quality assurance, and documentation. He is also the creator of, a Linux education and advocacy site featuring news, reviews, and extensive support for using the Linux command line.

Table of contents 


Part 1: Learning the Shell
Chapter 1. What Is The Shell?
Chapter 2. Navigation
Chapter 3. Exploring The System
Chapter 4. Manipulating Files And Directories
Chapter 5. Working With Commands
Chapter 6. Redirection
Chapter 7. Seeing The World As The Shell Sees It
Chapter 8. Advanced Keyboard Tricks
Chapter 9. Permissions
Chapter 10. Processes

Part 2: Configuration and the Environment
Chapter 11. The Environment
Chapter 12. A Gentle Introduction To vi
Chapter 13. Customizing The Prompt

Part 3: Common Tasks and Essential Tools
Chapter 14. Package Management
Chapter 15. Storage Media
Chapter 16. Networking
Chapter 17. Searching For Files
Chapter 18. Archiving And Backup
Chapter 19. Regular Expressions
Chapter 20. Text Processing
Chapter 21. Formatting Output
Chapter 22. Printing
Chapter 23. Compiling Programs

Part 4: Writing Shell Scripts
Chapter 24. Writing Your First Script
Chapter 25. Starting A Project
Chapter 26. Top-Down Design
Chapter 27. Flow Control: Branching With if
Chapter 28. Reading Keyboard Input
Chapter 29. Flow Control: Looping With while / until
Chapter 30. Troubleshooting
Chapter 31. Flow Control: Branching With case
Chapter 32. Positional Parameters
Chapter 33. Flow Control: Looping With for
Chapter 34. Strings And Numbers
Chapter 35. Arrays
Chapter 36. Exotica

View the detailed Table of Contents (PDF)
View the detailed Index (PDF)
Download a high-resolution cover.


"I can honestly say I have found THE beginner's guide to Linux."
Jayson Broughton, Linux Journal (Read More)

"The Linux Command Line is the ideal guidebook into the world of the Linux (and UNIX and BSD) command line."
Jesse Smith, DistroWatch (Read More)

"If you’re new to the command line there is definitely a lot that you can learn from this book."
Scott Nesbitt, Ubuntu Musings (Read More)

"This is exactly what a Linux beginner needs to get up to speed quickly. The book goes beyond simply walking through all of the command line utilities, and ventures into the realm of theory and how things work together."
Nicholas C. Zakas, Yahoo! (Read More)

"Anyone who reads this book and makes use of the examples provided will not be able to avoid becoming a Unix command line pro by the time they've hit the end of the book. It provides an excellent introduction to the command line that takes students from knowing nearly nothing to using impressively sophisticated commands."
Sandra Henry-Stocker, ITworld (Read More)

"Shotts displays a genuine talent for explaining complex material."
Bruce Byfield, Linux Magazine (Read More)

"The most approachable tome on the subject."
Federico Lucifredi, Linux Magazine (Read More)

"If you would like to start using the command line, improve your existing skills, or simply want to discover tools that you were never even aware existed, this book has everything you need, and I wholly recommend it."
Phil Bull, author of the official Ubuntu documentation (Read More)

"The book is a win and I happily give it a 10/10. Recommendation: Highest."
Ken Hess, The Frugal Networker (Read More)

"If you really want to know your way around a Linux box, this is the book to get."
Main Street Solutions (Read More)

"The best single source of Linux command line instruction available."
Ecommerce Developer (Read More)

"This is the best introduction to the command-line I have read." (Read More)

"There is so much information contained within this book, you're almost guaranteed to learn something. I did."
The Linux Blog (Read More)

"A perfect companion to more remedial guides to Linux that touch on the command only briefly, and also a terrific bridge to deeper technical programming books. Highly recommended."
Game Vortex (Read More)

"The Linux Command Line is pleasant to read. It has a light tone, while also getting down to business."
John D. Cook, The Endeavor (Read More)

"A delightful read and you can hand it to a junior colleague or friend with more limited Unix shell exposure and be confident that they come back significantly shell-wiser and probably happier."
Peter N.M. Hansteen, That Grumpy BSD Guy (Read More)

"If you're a novice Linux player, or just want to get beyond the pretty graphical wrapper of your MacBook, put this book at the top of your list."
Michael Larsen, TESTHEAD (Read More)

"Part of the power of the shell is in its almost infinite potential, which most shell users never master, but if you buy and then use The Linux Command Line to its fullest extent, your 'introduction' to the shell will be very impressive."
James Pyles, A Million Chimpanzees (Read More)

"There's no system administration in the book, just making your way around a filesystem and the tools you need to get results. It's the kind of skills I think people lose out on when they boot to a graphical interface in Ubuntu, for example, and then never experience these tools."
DragonFly BSD Digest (Read More)

"Shows you how to do just about everything you are ever likely to want to do with a computer using nothing but the command line and a plain text editor."
Stephen Chapman, (Read More)

"The Linux Command Line gets my highest recommendation for a book that educates and entertains with equal doses of practical knowledge and peripheral anecdotes."
Larry Cafiero, Lindependence Project (Read More)


Page 51
Under the Redirecting Standard Error section, the first sentence reads, "edirecting standard error lacks[...]." It should read, "Redirecting standard error lacks[...]."

Page 164
Under the heading Determining Device Names, the first sentence should read, "It’s sometimes difficult to determine the name of a device."