1

Display more user-friendly Linux man pages with the tldr command

 2 years ago
source link: https://www.redhat.com/sysadmin/tldr-linux
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Display more user-friendly Linux man pages with the tldr command

The tldr command provides a short list and examples of the most common ways to use Linux commands.

Posted: August 19, 2022 | %t min read | by Ricardo Gerardi (Red Hat, Sudoer)

Image
Laptop with sticky note, phone, notepad, and coffee

The Linux man (or manual) pages are a fantastic resource. They contain detailed usage for commands, including all of their options and usages. The problem with man pages is that they may offer too much information. What if you're already familiar with a command and just trying to remember which option you need to complete a specific task?

That's where tldr comes in handy. This tool's name comes from the acronym (or initialism) TL;DR, which stands for too long; didn't read. It's internet slang for a summary of a long text. In the same spirit, the tldr command-line tool summarizes a lengthy man page and consists mainly of examples.

What is the tldr command?

The tldr command-line tool is a client for the community tldr pages project. Instead of searching through pages and pages of information until you find the option you're looking for and perhaps reading how to use it, type tldr {command} to get a short list of the most common uses for that command. Chances are, you'll get what you need.

For example, the man page for the find command consists of over 1,100 lines. The tldr for find has just 30 lines, including eight practical examples:

$ tldr find

  find

  Find files or directories under the given directory tree, recursively.
  More information: https://manned.org/find.

  - Find files by extension:
    find root_path -name '*.ext'

  - Find files matching multiple path/name patterns:
    find root_path -path '**/path/**/*.ext' -or -name '*pattern*'

  - Find directories matching a given name, in case-insensitive mode:
    find root_path -type d -iname '*lib*'

  - Find files matching a given pattern, excluding specific paths:
    find root_path -name '*.py' -not -path '*/site-packages/*'

  - Find files matching a given size range:
    find root_path -size +500k -size -10M

  - Run a command for each file (use `{}` within the command to access the filename):
    find root_path -name '*.ext' -exec wc -l {} \;

  - Find files modified in the last 7 days and delete them:
    find root_path -daystart -mtime -7 -delete

  - Find empty (0 byte) files and delete them:
    find root_path -type f -empty -delete

This tool is not a replacement for the man command. The man pages are still the canonical and complete source of information for a Linux command. tldr is a nice complement that provides, at a glance, focused details to help you to get something done quickly.

Install tldr

The tldr project provides two versions of the client: Node.js and Python. Fedora Linux packages the Python client in the official repository, so you can install it using dnf:

$ sudo dnf -y install tldr

Install it on other Linux distributions using npm or pip3. For more information, consult the project repository.

[ Download now: Linux commands cheat sheet. ]

Use tldr offline

The tldr tool typically requires internet access to consult the tldr pages. The Python client available in Fedora supports downloading and caching these pages for offline access. To do this, run tldr with the -u option:

$ tldr -u
Updated cache for 3239 entries

Now you can use tldr when you're disconnected from the internet.

[ Get the guide to installing applications on Linux. ]

What's next?

The tldr pages are a community effort. Not all commands are available, but more commands are added regularly. You can help improve the existing examples or add missing commands to the project. For more information, consult the project's contribution guidelines.

For more information about tldr, you can always use tldr tldr.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK