The Linux Command Line
by William Shotts
Fifth Internet Edition Available Now!
Designed for the new command line user, this 555-page volume covers the same material as LinuxCommand.org but in much greater detail. In addition to the basics of command line use and shell scripting, The Linux Command Line includes chapters on many common programs used on the command line, as well as more advanced topics.
Released under a Creative Commons license, this book is available for free download in PDF format. Download it here.
The book is available in printed form, published by No Starch Press. Copies may be purchased wherever fine books are sold. No Starch Press also offers electronic formats for popular e-readers.
In addition to English, the printed book is also available in the following languages:
Find The Linux Command Line at your local library.
Want to translate the Creative Commons version of The Linux Command Line? Please see the Community Translation Policy for details.
The following community translations are now available:
- ArabicTranslation by Abd Allatif Eymsh
- Spanish (in progress). Translation by Adriano Sánchez
- Portuguese (in progress). Translation by Matheus Sales
- Italian (in progress). Translation by Francesco Cargiuli
- Romanian (in progress). Translation by Vlad Paval
What Readers Are Saying About The Linux Command Line!
«I have been using Linux for a little over a year. Read as much as I could including Rute, and many others. I have learned more in the first 93 pages of your book than any others. «
«What a great help your book has been for me! I was looking for a book like yours, but I never was able to find one that really walks the reader through the Linux command line in a general sort of way. Do you know of any others? If I recall, there are a lot of books dedicated to shell scripting, but none that are geared to regular command-line use.»
«Fantastic book!! I have recently switched from the legacy OS to Linux and I have been trying to find a distro that mimics this legacy OS in fear of using the terminal. I ran across this book and opened the terminal for the first time. This book teaches you everything you need to know about the shell and does it with ease. It starts by giving you a solid foundation and builds from there. Its simplicity and informative structure is ideal for all new beginners switching to Linux. I am now always on the terminal even for the simplest things. Not only does this build love, but I also get to practice my shell scripting. Great book!!»
«I’ve been enjoying reading the book and have learned a lot from every chapter. Your writing is very clear, and I’ve enjoyed following along with your examples. I’ve skimmed a couple of Linux books before, but never had enough time to really get into them. From those experiences however, I think your book is much clearer and approachable for beginners.»
«WOW! What a great book. It will clearly provide a stepping stone for many people who want to wean themselves off of their GUI habit, or perhaps just «Make the difficult possible.»
«I think one of the greatest assets of the book that most others about Linux don’t have is the conversational tone. I feel like in almost every chapter, there are parts where you lead the reader to ask questions of the material that aren’t necessarily covered.»
© 2000-2020, William E. Shotts, Jr. Verbatim copying and distribution of this entire article is permitted in any medium, provided this copyright notice is preserved.
Linux® is a registered trademark of Linus Torvalds.
The linux command line by william shotts
The Linux Command Line Fourth Internet Edition William Shotts
Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Clone with HTTPS
Use Git or checkout with SVN using the web URL.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
The Linux Command Line
Fourth Internet Edition
Copyright ©2008-2017, William E. Shotts, Jr.
About
The Linux Command Line Fourth Internet Edition William Shotts
Topics
Resources
Releases
Packages 0
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
The Linux Command Line: A Complete Introduction
Item Preview
Share or Embed This Item
Flag this item for
The Linux Command Line: A Complete Introduction
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.
This book has an editable web page on Open Library.
The Linux Command Line
By William Shotts
Motivation for learning Linux
I would consider Docker the most valuable tool in my tool belt as a software engineer. Docker is a tool that packages a software application and its dependencies together in a container so it can easily and reliably run on any Linux server.
Well what the heck is a container? A container is a self-contained Linux operating system that shares the kernel of the host operating system. An operating system (OS) is the first piece of software that the computer executes when it is turned on, and the kernel is the central part of an operating system that takes care of managing really important tasks, like managing memory.
The reason why I love using Docker is I do not need to dedicate an entire virtual machine on my personal computer for each project I am working on. Instead I can run multiple containers, which are ultimately lean Linux computers, on my own computer. Therefore in the process of learning how to use Docker, I have inadvertently been learning about the Linux OS.
In a previous post I shared how to use Docker to build a Rails application. To deploy this application I could use Amazon’s EC2 Container Service (ECS). I already created a Docker Compose file (docker-compose.yml) in order to coordinate communication between the Rails application and its PostgreSQL database. Using a service like ECS would make it possible to run, stop, and manage my Docker containers “in the cloud.”
Cloud services like AWS allow individuals and companies to no longer worry about setting up their own servers. You may remember the utter failure that the Pied Piper company experienced when trying to set up their own servers in the HBO show Silicon Valley.
I instead rely on Amazon’s computers, which are running on the Linux operating system, to serve my web application. Essentially each container would be deployed as a Amazon Elastic Compute Cloud (EC2) instance, and an instance is a “virtual server” in the “AWS cloud.”
A virtual server is just sexy way of saying an entire computer is not dedicated to a single server. And the AWS cloud is just referring to a bunch of computers located in an Amazon data center that have software on them that are dedicated to listening to HTTP requests and serving data to the client browser as requested.
Another big buzz word in cloud computing is “elastic,” and this really means that it has become easier for individuals and companies to scale up or down as needed and only pay for only the servers they use.
After I launch an instance, I can connect to it and use it the way that I would using the computer sitting right in front of me. In order to do this though, I need to be comfortable with the Linux OS. Specifically, I need to navigate my application in the cloud by using the command line.
I do not have the option of depending on the graphical user interface (GUI) like I do while working on my Mac OS. However, the nice thing about learning how to use the command line within a Linux OS is many of the commands work the same on my Mac OS. And as William E. Shott’s shared in the introduction of his book, “graphical user interfaces make easy tasks easy, while command line interfaces make difficult tasks possible.”
The Linux Command Line
The Linux operating system was and continues to be built by a community of people who do not want a few giant corporations to control what they can do with their computer. I believe in this spirit, the writer William E. Shott has made his book The Linux Command Line freely available online.
The Linux Command Line by William E. Shotts, Jr.
The Linux Command Line by William E. Shotts, Jr.
The Linux Command Line by William E. Shotts, Jr.linuxcommand.org
If you are interested in following along the book and have a Mac, I would suggest playing around with running the commands both in your Mac OS terminal as well as in a Linux OS terminal. In order to get a Linux OS running on your Mac computer, you can use VirtualBox. The link below gives very clear instructions on how to do so, and it will only take you a few minutes to get a Linux OS up and running.
How to Install Ubuntu on Your Mac Using VirtualBox
This in depth guide will take you every step of the way through installing Ubuntu Linux on your Mac, by way of…
www.simplehelp.net
I would definitely recommend you read the book yourself! This post will just give you a little taste of the power of the command line, along with some helpful tips and tricks I’ve learned as part of the San Diego Technology Immersion Group (SDTIG).
Navigation
When we interact with our operating system using the command line in our terminal, we are really interacting with the shell. The shell is a program that takes keyboard commands and passes them to the operating system to carry out, and most versions of Linux supply a shell program called bash.
One of the first things we can do to start getting familiar with our Linux OS is to navigate the file system. With Linux, everything is a file, and we have the power to know everything about our Linux OS because it is open source software!
If you are already using the terminal on your current OS, you may already be familiar with the commands pwd, cd, and ls. Also, it helps to know that Linux uses the term directory to describe a folder. Directory and folder are the same thing.
pwd (print working directory) prints where I currently am in the file system
cd allows us to change directories (move from one directory to another)