DEV Community

Jonathan Lee
Jonathan Lee

Posted on

Getting Help on Linux: man, less, --help and cheat.sh

Instead of asking AI or searching on the Internet, using the manuals within you system ensures it complies with your system exactly, not something generally assumed. And you can use it without Internet, and get it faster.

Get the system reference manual of a command by execute man command, like

#show the manual of command man
man man
Enter fullscreen mode Exit fullscreen mode

For learning purposes, reading the SYNOPSIS, DESCRIPTION, EXAMPLES, and NOTES sections, skimming the available groups of options, don't read linearly. For man pay attentions to:

# Searches names
man -f [whatis options] page ... 
# Searches both names and descriptions for the keyword as a substring/regex. 
man -k [apropos options] regexp ...
# Searches for text in all manual pages
man -K [man options] [section] term ...
Enter fullscreen mode Exit fullscreen mode

When you encounter something you don't know or unfamiliar with, using these commands to find its manuals for helps.

command --help can give you a help list of the command, like dnf --help. It is very helpful to remind you what commands or options you need to use. And, get a glance of the whole picture.

On that note, execute man less to see how to use it. The most import command of less is h , giving you the help. You might use daily

  • j/k scroll up/down
  • Space/b page forward/back
  • /pattern search
  • n/N next/previous match
  • g/G jump to top/bottom
  • q quit

Now you can use these command to help you read the manuals, as they are displayed by less. When you are reading a manual, you can use /^EXAMPLES to jump between sections.

Using curl cheat.sh/command, you can get a cheat list of the command, like

curl cheat.sh/apt
Enter fullscreen mode Exit fullscreen mode

It is quite concise and practical. You will not remember all commands and options that you only use casually. Manuals is too long, --help is to short, this is the best option for real uses.

Top comments (0)