• United States
Unix Dweeb

10 of the best ways to get help on Linux

Apr 13, 20217 mins

There are many ways to get help while working on the Linux command line. Here are details on some of the most useful.

One large glowing question mark surrounded by many small question marks.
Credit: CarlosCastilla / Getty Images

Just because Linux appeals to the nerdiest of nerds doesn’t mean that it can’t be extremely helpful for those who don’t want to spend a lot of time delving into the technical details of how to use various commands. In fact, Linux provides a series of tools that can help anyone master the command line or just get the task at hand done more quickly and efficiently. This post covers 10 of the best options.

man pages

You can always go to the man pages to answer usage and syntax questions you might have on a Linux command. Just type “man” followed by the name of the command (e.g., man ps), and you’ll get a lot of descriptive information. 

On the other hand, if you really just want to see some examples of how to use a particular command, the content of a man page might be a lot more than you want to comb through. In the remainder of this post, I’ll explain some other options for finding the command that you need and learning how to use it.


One of the easiest ways to find the command you need is to use the apropos command. It will fetch the primary description line from the man page of every command that includes the word that you are asking about. For example, if you’re looking for a tool that allows you to select command output based on some pattern, you might do this:

shs@firefly:~$ apropos pattern
apt-patterns (7)     - Syntax and semantics of apt search patterns
awk (1)              - pattern scanning and text processing language
dh_installtex (1)    - register Type 1 fonts, hyphenation patterns, or formats with TeX
egrep (1)            - print lines that match patterns
fc-pattern (1)       - parse and show pattern
fgrep (1)            - print lines that match patterns
gpg-check-pattern (1) - Check a passphrase on stdin against the patternfile
grep (1)             - print lines that match patterns
magic (5)            - file command's magic pattern file
mawk (1)             - pattern scanning and text processing language
nawk (1)             - pattern scanning and text processing language
patgen (1)           - generate patterns for TeX hyphenation
pcrepattern (3)      - Perl-compatible regular expressions
ptargrep (1)         - Apply pattern matching to the contents of files in a tar archive
rgrep (1)            - print lines that match patterns
Text::Glob (3pm)     - match globbing patterns against text
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern

The output clearly shows a lot of commands – likely some that you’ve never used before and others unrelated to what you are hoping to do. Based on the descriptions shown, though, you should be able to find one that does just what you need.

man -k

As it turns out, the man -k command will provide the same output as apropos. You can use whichever you prefer or make your search even easier by setting up an alias like this:

$ alias ?="apropos"

With this alias, you would be able to type “? pattern” to get the output shown above and you won’t have to spell “apropos” or remember the -k option with the man command.

command -h and command –help

Some Linux commands provide a brief usage summary when you use the -h option. Some will generate a usage statement because they don’t offer this option and so assume you don’t quite know what you’re doing when you use it, but even usage statements can be helpful. Others simply recommend using the –help option instead.

shs@firefly:~$ pwd -h
-bash: pwd: -h: invalid option
pwd: usage: pwd [-LP]                      
shs@firefly:~$ mkdir -h
mkdir: invalid option -- 'h'
Try 'mkdir --help' for more information.   


The whatis command can be used to provide a very brief description of whatever command you provide as an argument, sometimes confirming the command is what you were expecting.

shs@firefly:~$ whatis grep
grep (1) - print lines that match patterns
shs@firefly:~$ whatis useradd
useradd (8) - create a new user or update default new user information


The help command sounds very useful and it is, but it only provides help on bash built-ins. If you ask about other things, you’re likely to get a response like this:

$ help mkdir
-bash: help: no help topics match `mkdir'.  Try `help help' or `man -k mkdir' or `info mkdir'.

At least it points you in the right direction. For bash builtins, however, the output will likely be far more useful!

shs@firefly:~$ help while
while: while COMMANDS; do COMMANDS; done          
    Execute commands as long as a test succeeds.

    Expand and execute COMMANDS as long as the final command in the
    `while' COMMANDS has an exit status of zero.

    Exit Status:
    Returns the status of the last command executed.


The info command is different from the other help commands described. It displays a lot of information – often more than the man pages – on commands that you ask about. The contents are also navigable. That is, you can click on an underlined “link” in the displayed text and move into a different section within the information provided.

The info content is derived from files in the /usr/share/info directory. The files are unzipped as you use the info command. If this directory does not include a file relevant to what you are asking about, info will show you the man page instead.


Aliases will not provide information on how to use commands, but can be a great boon to remembering them – especially those that are complex or require a string of options to do what you want. Here are some examples that I use to avoid command complexity:

alias dirsBySize='du -kx | egrep -v "./.+/" | sort -n'
alias myip='hostname -I | awk '''{print }''''
alias oct2dec='f(){ echo "obase=10; ibase=8; $1" | bc; unset -f f; }; f'
alias recent='ls -ltr | tail -5'
alias rel='lsb_release -r'
alias side-by-side='pr -mt '


There’s a very useful snap called “cheat” that can be used to print a cheat sheet for a particular command, It will contain a lot of useful examples of how to use the command. You do, however, have to be using a system that supports snaps (distribution-neutral packages) and install cheat.

Here’s a truncated example of what you might see:

shs@firefly:~$ cheat grep
# To search a file for a pattern:

# To perform a case-insensitive search (with line numbers):
grep -in  

# To recursively grep for string  in :
grep -R  

# Read search patterns from a file (one per line):
grep -f  

# Find lines NOT containing pattern:
grep -v  

# To grep with regular expressions:
grep "^00"                                                # Match lines starting with 00
grep -E "[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}"  # Find IP add

cheat sheets

You can also locate and use a prepared Linux cheat sheet, whether you print it and keep it on your desktop or download a PDF that you can open when needed. It’s hard to know all of the commands available on Linux or all of the options available with any particular command. Good cheat sheets can save you a lot of trouble by providing common usage examples.

Unix Dweeb

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as "USL" (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she's chasing the bears away from her bird feeders.

The opinions expressed in this blog are those of Sandra Henry-Stocker and do not necessarily represent those of IDG Communications, Inc., its parent, subsidiary or affiliated companies.

More from this author