Command-Not-Found and TLDR

command-not-found is great website to get recommendation on how to install a particular package on Linux based OSes. To install it on Debian or Ubuntu run:

apt install command-not-found

Update its database(this will take a minute or two):

update-command-not-found

command-not-found will look into your package manager repository to find the package you’re looking for. Run an apt update in case you don’t find something that should have been available.

On my VM, I don’t have iostat:

root@debian:~# iostat
-bash: /usr/bin/iostat: No such file or directory

root@debian:~# apt install iostat
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package iostat

Run command-not-found and the package name to see what provides it:

root@debian:~# command-not-found iostat
Command 'iostat' not found, but can be installed with:
apt install sysstat

By specify a package that’s already installed, it will show you where it’s available on your system:

root@debian:~# command-not-found htop
Command 'htop' is available in the following places
 * /bin/htop
 * /usr/bin/htop
htop: command not found

The command not found at the end is printed by default. I don’t know why it does that. You can remove it with --no-failure-msg:

root@debian:~# command-not-found htop --no-failure-msg
Command 'htop' is available in the following places
 * /bin/htop
 * /usr/bin/htop

tldr on the other hand, provides command-line tools cheatsheet on the terminal. You’ll need python3 and pip to install its web client:

pip3 install tldr

Then run tldr -c [command_name]:

root@debian:~# tldr -c ls | grep -A5 hidden
  - List all files, including hidden files:
    ls -a

  - List all files, with trailing `/` added to directory names:
    ls -F

root@debian:~# tldr -c ps | head
  ps
  Information about running processes.  More information: https://manned.org/ps.
  - List all running processes:    ps aux
  - List all running processes including the full command string:    ps auxww
  - Search for a process that matches a string:    ps aux | grep string
  - List all processes of the current user in extra full format:    ps --user $(id -u) -F
  - List all processes of the current user as a tree:    ps --user $(id -u) f
  - Get the parent PID of a process:    ps -o ppid= -p pid
  - Sort processes by memory consumption:    ps --sort size

....REDACTED

The -c flag will strip the color codes. It makes things easier when you want to pipe the output to something like grep or less.

You can also look for commands on other platforms with -p:

$ tldr -c sed -p osx | less

“The future depends on what you do today.”Mahatma Gandhi