How to Shorten Man Pages Into Readable Explanations on Linux and macOS
Pinterest Stumbleupon Whatsapp
Advertisement

When all else fails, read the manual. Command line A Quick Guide To Get Started With The Linux Command Line A Quick Guide To Get Started With The Linux Command Line You can do lots of amazing stuff with commands in Linux and it's really not difficult to learn. Read More 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 Top Websites and Books to Transform You into a Linux Command Line Hero Top Websites and Books to Transform You into a Linux Command Line Hero The Linux command line is an extremely powerful tool -- but it can also be intimidating. Use these websites and books to get a handle on it. Read More 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.

shorten man pages with tldr command linux mac

You can fix this error by creating a symlink What Is a Symbolic Link & What Are Its Uses? [MakeUseOf Explains] What Is a Symbolic Link & What Are Its Uses? [MakeUseOf Explains] Read More . Type the following command.

sudo ln -s /usr/bin/nodejs /usr/bin/node

Install tldr on macOS

On macOS, we’ll use Homebrew Install Mac Software From Terminal With Homebrew Install Mac Software From Terminal With Homebrew Install (almost) any free Mac app by typing four words and hitting "Enter". Read More , 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.

man ls

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.

shorten man pages with tldr command linux mac

Now, type the following command.

tldr ls

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.

shorten man pages with tldr command linux mac

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.

shorten man pages with tldr command linux mac

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.

shorten man pages with tldr command linux mac

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.

shorten man pages with tldr command linux mac

Need an offline copy? Download a PDF version of the tldr pages, for use later. You can even install a tldr app on your Android or iOS device.

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.

man bash-builtins

You might also want to try out the Fish shell 7 Reasons Why You Should Install The Fish Shell 7 Reasons Why You Should Install The Fish Shell Don't like how your Linux terminal works? Why not install a new shell? One such shell is fish, which introduces features that should have become commonplace, but didn't. Let's take a look. Read More , 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Marc
    October 20, 2017 at 6:37 am

    You state "That begs the question, what’s Linux?". It actually asks, or presents, or even suggests the question. It does not beg the question. Begging the question is a logical fallacy.

    • Not Sure
      October 20, 2017 at 1:07 pm

      Precisely.

    • dragonmouth
      October 20, 2017 at 1:44 pm

      Pedant.