The Linux command line can seem impenetrable, with arcane instructions and a focus on text interfaces. Fortunately, there are plenty of resources and tools to help you get started.
1 Customize Your Terminal to Fit Your Needs
The first thing you should do is make your learning environment as comfortable as possible. You don’t want to spend too much time tweaking every last setting, but getting the basics right can make everything that follows a little bit smoother.
The settings will vary depending on your distro, but things to look out for include:
- Light/dark mode: pick whichever you’re most comfortable reading text in.
- Font: you’ll want to use something monospaced with clear differences between similar characters e.g. “0” (zero) and “O” (uppercase “oh”).
- Whether to open new terminals in tabs or windows.
You’ll also want to know how to use keyboard shortcuts since 99% of your work on the command line will involve typing. Don’t be afraid to open several terminal windows (or tabs) to run commands simultaneously and organize your tasks.
2 Customize Your Shell to Your Liking
Once you’ve customized your terminal app, you should make a couple of small changes to your shell. This is typically bash, although you can change it to an alternative shell, like fish or zsh.
One of the best quick upgrades you can make is to customize your prompt, the text your shell displays at the beginning of each line. The default is quite useful, but you can make it more useful for learning Linux. I like to use this setup:
export PS1="\n[\$PWD] \$ "
This will remove things like your username and host, which you probably won’t care about when starting. It also displays the full path of your current directory rather than just its name, making it easier to see your current location at a glance:
You can make this setting permanent by adding it to your .bashrc (or similar) file. That file is also a great place to set up aliases, which act like shortcuts for commands. If you find it difficult to remember a command’s name, or its most useful default options, set up an alias, e.g.
alias list='ls -l'
3 Learn All About Commands With man (and Alternatives)
Each command you’ll need to learn has built-in documentation that you can read using the man tool. These “man pages” explain what a command does, different modes of operation, what files it requires, etc.
The man pages are comprehensive, but they can be a bit overwhelming, especially when you’re getting to know the system. Fortunately, there are alternatives.
Each command will usually support a -h or –help option, which explains how to use it in a simpler form:
The tldr tool condenses long man pages into more manageable summaries. Here’s a comparison of a classic man page on the left alongside the tldr equivalent on the right:
tldr shows minimal information, following it up with clear examples for the most common uses of each command. You can install it using your system’s package manager. If you just want to try tldr out, its web interface is excellent:
4 Find the Commands You Need With apropos
Linux commands often have short, abbreviated names for historical reasons. It can be tricky to remember your “chown” from your “sudo.”
First, try exploring the directories listed in your PATH variable. These will contain programs you can run on the command line. Run:
echo $PATH
That shows a set of directories with colon (:) characters between them. Then run:
ls dirname
This will show the contents of one of these directories. And files that appear are executable commands you can run:
If you’re still having trouble identifying a command, try apropos, a search tool for man pages. Use it when you’re looking for a specific command, but you’re not sure what it’s called. Just run:
apropos keyword
That will search for a keyword and see relevant man pages.
5 Consult These Excellent and Approachable Resources
For further reading, there are plenty of online resources you can consult for free. Find a reliable source that caters to your level of experience and work through everything it has to offer.
The Linux command line for beginners guides you from the very beginning, covering all the basics you’ll need when setting out. It’s aimed at Ubuntu users, but if you can open a terminal, you’ll be able to follow everything.
Linux Journey: Command Line provides a short overview of the most important commands, with associated exercises and interactive quiz questions.
Linux command line for you and me has everything for absolute beginners to more advanced users, so work through it from beginning to end if you’re aiming to be an expert. It’s also highly usable as a reference source.
This Linux Tutorial from Ryans Tutorials explains the core concepts with plenty of interesting asides, tips, and insight. It features many diverse examples which help to explain how the command line works.
6 Take a Deep Dive With Manuals From the Linux Documentation Project
The LDP is a long-standing initiative to create free, quality documentation on everything to do with Linux. As such, it offers a wealth of obscure, illuminating material, not all of which is useful for beginners.
However, there are still some excellent sources of information, if you’re willing to overlook the old-school presentation.
GNU/Linux Command-Line Tools Summary covers all sorts of built-in commands and how to use the command line. It also shows examples on how to run many of them.
Bash Guide for Beginners explains the specifics of the bash shell, how it handles your commands, and how you can write your own scripts.
7 Continue With More Articles From How to Geek
We have a wide selection of Linux articles, for beginners and more advanced users. Several of them are already linked in this article, but here are some others that you’ll find …