When all else fails, read the manual. Command line users on Linux and Mac know they can type “man” followed by a command name to see a long, detailed explanation of that command. These man pages are useful but verbose. Sometimes all you need is a short, concise explanation of a command to refresh your memory.
Here’s an easy way to get concise, practical explanations of commands used on the command line on Linux and Mac. It’s a command line app called “tldr”, after the abbreviation for “too long; didn’t read”. The tl;dr abbreviation is used to write or request a shortened version of text, which is exactly what the tldr command does.
Install tldr on Ubuntu
The tldr command on Ubuntu is not available in any repository, so there’s a bit of a roundabout way of installing it. But it’s not hard.
First, we need to install NodeJS and the Node Package Manager (npm). Press Ctrl + Alt + T to open the Terminal and type the following command.
sudo apt install nodejs npm
Next, we’re going to use npm to install tldr. Type:
sudo npm install -g tldr
You should be able to use tldr now, but you may see an error saying, “No such file or directory” when you try.
You can fix this error by creating a symlink . Type the following command.
sudo ln -s /usr/bin/nodejs /usr/bin/node
Install tldr on macOS
On macOS, we’ll use Homebrew , the package manager for macOS, to install tldr. Homebrew allows you to install any command line utility with just a few keystrokes. Adding Cask to Homebrew allows you to also install desktop apps, like Firefox and GIMP. Updating command line utilities and desktop apps is easy with Homebrew and Cask.
Homebrew is not installed by default. Head to the Homebrew website and copy the installation command from there. We didn’t include it here in case it changes.
To install Homebrew, open the Terminal from the Utilities folder in the Applications folder. Right-click at the command line prompt and select Paste to enter the Homebrew installation command you copied. Press Enter and follow the instructions as they’re presented.
Once Homebrew is installed, type the following command to install the tldr command.
brew install tldr
Now, you can use the tldr command to get short, concise explanations for commands.
Use tldr to Quickly Find Out How to Use a Command
We’ll use the ls command to illustrate the difference between using man and tldr. The screenshots are from Linux, but it works the same way on macOS.
Type the following command at the prompt.
You’ll see the long-winded, detailed explanation of the ls command that goes on for pages. Use the arrow keys and the Page Up and Page Down keys to navigate through the man page for the ls command.
Now, type the following command.
You’ll see a much shorter description of the most common usages of the ls command. Notice you don’t have to scroll through the results, at least much. We made our Terminal window slightly taller to show all the results at once.
Use the Web Version of tldr
If you don’t want to install tldr, or you’re having trouble doing so, there’s a great web version of the tldr utility at https://tldr.ostera.io/. They include a brief explanation on how to use the site. This is also handy if you’re already in a browser and want to quickly look up a command without opening a Terminal window.
For example, type “ls” in the search box at the top of the page. The results display immediately. You may find this even easier to read than the results of the tldr command on the command line.
They even provide an Edit this page on Github link at the bottom of the page for each command in case you see any mistakes.
You can also create or edit commands on the TLDR Pages website.
man Pages Are Still Useful
The tldr command is handy for learning the basics about a command. But there are command parameters left out that you might find useful. So, if you don’t see what you’re looking for on the tldr page for a command, check the man page, if the command has one.
For example, the tldr page for the ls command leaves out the following useful parameters. Parameters are case sensitive.
- -R: List subdirectories recursively.
- -X: Sort alphabetically by the file extensions.
- -d: List only the directories, not their contents.
Another example is the rm command, which removes files and directories. With a certain parameter, it can be used to wipe the entire contents of a specified directory. Be careful with this command as you can end up deleting critical system files if used incorrectly.
- -I: Prompt once before removing more than three files, or when removing files recursively. This parameter is less intrusive than -i, while still protecting you against accidentally removing files you don’t want to remove.
- -d: Remove empty directories.
While the tldr page for the rm command does list the -r parameter for recursively removing a directory and all its subdirectories, it doesn’t explain that rm does not remove non-empty directories by default. You must use -r or -R to recursively remove non-empty directories.
Save Time With the tldr Command
The tldr command gets right to the point with short explanations and practical examples of bash shell commands. You may even find concise explanations for some built-in commands no longer available as man entries, like the cd command.
You can find out all the built-in commands available in the bash shell by typing the following command on the command line.
You might also want to try out the Fish shell , which has additional features like auto-suggestions, VGA colors, and a scripting language inspired by modern programming languages like Python and Ruby.
Do you find the explanations in tldr easier to understand? Or do you prefer the full, detailed explanations on the man pages? Share your thoughts and experiences with us in the comments below.