If you’re new to Linux and the terminal, I can appreciate how difficult it is to learn. Learning Linux was not an easy task. Fortunately, I have three tools for you that will make learning and using the Linux terminal long-term significantly easier.
tldr: When You Just Want Examples
Learning the terminal can be difficult, but here’s a tip: you don’t need to memorize every command. Only commands that you use most often will you remember. Notes and man pages are the typical way to jog your memory, but they can be time-consuming. What we need is a way to quickly bootstrap ourselves, to cut through all the noise and go directly to what matters—enter the tldr command.
The tldr (too long; didn’t read) command simply prints cheat sheets for provided command names. It provides the most common options and examples for over 6,000 commands for Linux and hundreds for Windows and macOS. No matter what command you need concise examples for, tldr probably has it.
The FFmpeg command is a perfect example because it’s complex, so let’s take a look at the TLDR cheat sheet for that. The following command will produce the cheat sheet.
tldr ffmpeg
The commands in the cheat sheet may not satisfy your specific needs, but they do provide valuable insight for important options. For example, the meaning of the “-codec:v” flag may not be immediately apparent, but you can probably guess what the “v” stands for. A quick search of the man page, and it becomes obvious.
The tldr command highlights the most important and commonly used flags, helping you infer which options might be most useful.
The tldr command downloads its cheat sheets from the tldr GitHub repository. In addition to the command-line tool, the project offers the tldr web app and more than 85 tldr clients, including one for Android. The classic client can be installed with one of the following commands.
To install tldr on Debian, execute the following command:
sudo apt install tldr-py
To install tldr on Fedora, execute the following command:
sudo dnf install tldr
To install tldr on Arch Linux, execute the following command:
sudo pacman -S tldr
If you’re interested in a more comprehensive look at it, we have a guide on the tldr command.
cheat.sh: Like tldr With Broader Answers
Cheat.sh is another great cheat sheet resource, much like tldr, but with more comprehensive answers that span a wider range of topics. While cheat.sh answers questions about Linux commands, it also answers programming questions. The answers from cheat.sh are more detailed than the tldr command, and the provided script is more advanced and scriptable.
A Simple Demo
There are three ways to use cheat.sh: via curl, the script, or its shell.
Using cheat.sh with curl is simple if you understand the construction of a typical URL. The ” at the end of the URL is called the path, and a slash alone (without other words) is called the root path. To query Linux commands, we must query the root path. To query a cheat sheet for the FFmpeg command, enter the following command:
curl
You can also use the cheat.sh script for more concise queries.
cht.sh ffmpeg
The script also has a shell that you can launch with the following command.
cht.sh --shell
In the shell, just type the name of the command and hit the Enter key.
Cheat.sh is powerful enough to understand question-based queries, although your results may vary.
cht.sh python reverse a list
I said that it was scriptable, and if you have the fzf utility installed, the following command allows you to interactively pick a cheat sheet. Refer to your distro’s package manager manual to install the fzf package.
cht.sh `cht.sh :list | fzf`
Installation Instruction
You don’t need to install the script because you can access the cheat sheets directly via curl. However, the shell script makes executing queries more concise, and it even provides an interactive shell. You can install the cht.sh shell script using the following sequence of commands.
If you have a suitable directory on your PATH, then you can skip this step. If you don’t, or are not sure, then execute the following commands:
mkdir -p ~/.local/bin
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
source ~/.bashrc
To learn more about it, refer to our guide on the Linux PATH variable.
Now you should install the script itself into the target directory:
curl -s | install /dev/stdin ~/.local/bin/cht.sh -m 755
Before running the cht.sh command, you need to install the rlwrap dependency.
To install rlwrap on Debian, execute the following command:
sudo apt install rlwrap
To install rlwrap on Fedora, execute the following command:
sudo dnf install rlwrap
To install rlwrap on Arch Linux, execute the following command:
sudo pacman -S rlwrap
apropos: When You Don’t Know What Command to Use
The apropos command serves one simple function: to search man page descriptions for the provided keywords. For example, if you execute apropos ffmpeg in your terminal, you may see something like the following:
The apropos ffmpeg command is equivalent to man -k ffmpeg.
Some commands have many manuals available, and by using the apropos command, you can become familiar with them all. If you’re unfamiliar with the terminal, the apropos command is also perfect for finding suitable commands (not just man pages)—often it should be your first port of call.
The apropos command works by scanning manual descriptions for keywords, so when constructing your query, try to imagine what keywords would typically exist. You may need to sometimes try a few different keywords.
By default, it matches any of the keywords you enter, but you can modify this behavior with the “–and” flag, which makes a result match only if all the specified words appear in its description.
apropos --and ffmpeg converter
Man pages are categorized into sections, and shell commands come under section one—execute the man man command for more details, or see our guide on how man pages work. We can limit our search to a specific section using the “–section” or “-s” flag, reducing noisy output from irrelevant sections.
apropos --section 1 ffmpeg
If you have the fzf utility installed, I’ve created a handy little tool for you to quickly choose and open a man page. Put the following command into your .bashrc file and reload your shell by executing source ~/.bashrc.
function manpick() {
  (( $# == 0 )) && return
  apropos --section 1 $@ | fzf | awk '{print $1}' | xargs man
}
Now, execute manpick archive in your terminal to see all the available archiving commands. You can narrow down your search by typing something into the fzf prompt. Once you find a relevant man page, hit the Enter key, and it should open the manual page for you. You can also provide extra flags to the apropos command, for example, manpick –and ffmpeg converter.
The apropos command should be installed by default in all distros. If it’s not installed in yours, then refer to your distro’s package manager and install the man-db package.
These tools won’t just help you learn the terminal but also help you long after becoming competent. After many years of using Linux, I still need to frequent the documentation. This isn’t specific to the terminal; all software can be like that. Quite often commands can share common flags, so it may be worth learning those too.