Quick Links
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.
1Customize 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:
You’ll also want to know how touse keyboard shortcutssince 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.
2Customize 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, althoughyou can change it to an alternative shell, like fish or zsh.
One of the best quick upgrades you can make is tocustomize 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:
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 upaliases, 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.
3Learn All About Commands With man (and Alternatives)
Each command you’ll need to learn has built-in documentation that you canread 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:
Thetldr tool condenses long man pagesinto 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’re able to install it using your system’s package manager. If you just want to trytldr out, its web interfaceis excellent:
4Find 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 yourPATH variable. These will contain programs you can run on the command line. Run:
That shows a set of directories with colon (:) characters between them. Then run:
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:
That will search for a keyword and see relevant man pages.
5Consult 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 beginnersguides you from the very beginning, covering all the basics you’ll need when setting out. It’s aimed at Ubuntu users, but if you may open a terminal, you’ll be able to follow everything.
Linux Journey: Command Lineprovides a short overview of the most important commands, with associated exercises and interactive quiz questions.
Linux command line for you and mehas 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.
ThisLinux Tutorial from Ryans Tutorialsexplains 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.
6Take a Deep Dive With Manuals From the Linux Documentation Project
TheLDPis 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 Summarycovers 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 Beginnersexplains the specifics of the bash shell, how it handles your commands, and how you can write your own scripts.
7Continue 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 …