How to Use the ‘tldr’ Command in Linux

Cut through the Linux command-line clutter with 'tldr', your go-to for straightforward examples.

The tldr command in Linux, an acronym for “Too Long; Didn’t Read,” serves as a simplified and community-driven approach to understanding various command-line tools. Unlike the traditional man pages that provide exhaustive details, tldr offers concise and practical examples to help users quickly grasp the essence of a command.

It’s often used in conjunction with commands like man and info for a more comprehensive understanding. Whether you’re a seasoned professional looking to refresh your memory or a newcomer seeking to learn the ropes, tldr can be a handy companion. Alongside this command, you might also find tools like cheat useful, offering similar functionality but with personalized cheat sheets.

How to Install the tldr Command

tldr command is not included by default in most Linux distributions, so you will need to install it. The installation method can vary depending on the package manager your system uses. Here’s a general guide for installing and uninstalling tldr:

Debian-based systems (e.g., Ubuntu)

Install:

sudo apt update
sudo apt install tldr

Uninstall:

sudo apt remove tldr

Red Hat-based systems (e.g., Fedora)

Install:

sudo dnf install tldr

Uninstall:

sudo dnf remove tldr

Arch Linux

Install:

sudo pacman -S tldr

Uninstall:

sudo pacman -R tldr

macOS (using Homebrew)

Install:

brew install tldr

Uninstall:

brew uninstall tldr

Using Node.js (cross-platform)

Install:

npm install -g tldr

Uninstall:

npm uninstall -g tldr

How to Use tldr

1. Viewing a Summary of the ls Command

Syntax: ls

Explanation: Lists files and directories in the current directory.

Example: tldr ls

Output:

ls
List directory contents.

- List files one per line:
  ls -1

- List all entries except for '.' and '..':
  ls -A

- Long format list (permissions, ownership, size, and modification date) of all files:
  ls -la

The output provides a brief summary of the ls command and shows some common usage examples, such as listing files one per line, excluding certain entries, and displaying detailed information.

2. Viewing a Summary of the grep Command

Syntax: grep

Explanation: Searches for a pattern within a file or text.

Example: tldr grep

Output:

grep
Print lines matching a pattern.

- Search for an exact string:
  grep 'search_string' file.txt

- Search for a pattern, ignoring case:
  grep -i 'search_string' file.txt

- Search for a pattern in all files recursively in the current directory:
  grep -r 'search_string' .

The output provides a concise summary of the grep command and includes examples of searching for an exact string, ignoring case, and performing a recursive search in the current directory.

3. Viewing a Summary of the tar Command

Syntax: tar

Explanation: Archives and compresses files and directories.

Example: tldr tar

Output:

tar
Archiving utility.

- Create an archive from files:
  tar cf target.tar file1 file2 file3

- Extract an archive in a target folder:
  tar xf source.tar -C folder

- Create a gzipped archive:
  tar czf target.tar.gz folder

The output provides an overview of the tar command and includes examples of creating an archive from files, extracting an archive to a specific folder, and creating a gzipped archive.

More Linux commands:
Directory Operations rmdir · cd · pwd · exa · ls
File Operations cat · cp · dd · less · touch · ln · rename · more · head
File System Operations chown · mkfs · locate
Networking ping · curl · wget · iptables · mtr
Search and Text Processing find · grep · sed · whatis · ripgrep · fd · tldr
System Information and Management env · history · top · who · htop · glances · lsof
User and Session Management screen · su · sudo · open
WebsiteFacebookTwitterInstagramPinterestLinkedInGoogle+YoutubeRedditDribbbleBehanceGithubCodePenWhatsappEmail