• United States
Unix Dweeb

Getting help on Linux

Jul 05, 20236 mins

There are a lot of ways to get help on Linux, especially when you're getting started and want to learn a number of important commands.

Shot of a young woman helping her colleague

If you’re fairly new to Linux, you might need some help getting started on the command line. But you made it here, so let’s run through a number of ways that you can get comfortable and up to speed fairly quickly.

Man pages

Every Linux command should have a “man page” (i.e., manual page) – an explanation of what the command does, how it works and the options that you can use to specify what you want the command to show you. For example, if you wanted to see the options for formatting the output of the date command, you should look at the man page with the command “man date”. It should among other things, show you the format of the date command like this:

       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

In syntactical descriptions such as this, anything in square brackets is optional. You can use the date command simply by typing “date” and nothing more. The vertical bars in the first square-bracketed portion of the syntax shown mean “or”, so you select from the options shown if you want to see the date and time in “universal time” (the primary time standard by which the world regulates clocks and time).

$ date -u
Mon Jul  8 06:03:21 PM UTC 2023

Man pages will, after syntactical descriptions, go on to explain each of the options, often providing examples. Options for the date command include these and others:

  -d     output short description for each topic
  -s     output only a short usage synopsis for each topic matching PATTERN
  -u, --utc, --universal
          print or set Coordinated Universal Time (UTC)

NOTE: Most any command that does not have its own man page is likely a “built-in” – a command that is built into another command’s executable file. For example, the bash shell has a number of built-ins that make it easier to use.

Apropos command

The apropos command will list commands that are related to whatever you ask about. Use the command shown below and you’ll get a list of commands and explanations related to passwords.

$ apropos password
chage (1)            - change user password expiry information
tpm2_policypassword (1) - Enables binding a policy to the authorization value of the authorized TPM object.
git-credential-cache (1) - Helper to temporarily store passwords in memory
grub2-mkpasswd-pbkdf2 (1) - generate hashed password for GRUB
htdbm (1)            - Manipulate DBM password databases
lchage (1)           - Display or change user password policy
lpasswd (1)          - Change group or user password
openssl-passwd (1ossl) - compute password hashes
openssl-srp (1ossl)  - maintain SRP password file
pwmake (1)           - simple tool for generating random relatively easily pronounceable passwords
pwscore (1)          - simple configurable tool for checking quality of a password
secret-tool (1)      - Store and retrieve passwords
sshpass (1)          - noninteractive ssh password provider
systemd-ask-password (1) - Query the user for a system password
systemd-tty-ask-password-agent (1) - List or process pending systemd password requests
vncpasswd (1)        - change the VNC password

Help command

The Linux help command will provide information on built-ins. For example, you can ask help about the help command. The response, as shown below, shows that help is itself a built-in.

$ help help
help: help [-dms] [pattern ...]
    Display information about builtin commands.

    Displays brief summaries of builtin commands. If PATTERN IS
    specified, gives detailed help on all commands matching PATTERN,
    otherwise the list of help topics is printed.

Options include:

      -d        output short description for each topic
      -m        display usage in pseudo-manpage format
      -s        output only a short usage synopsis for each topic matching

On some systems, when you ask for help for a built-in, you’re going to get a very long page describing all of the built-ins. You will have to scroll down until you find the section that describes the built-in you’re asking about.

Which command

The which command will identify the executable that represents a particular command. Notice that the which command will not provide information on built-ins because it only looks for files and built-ins are included only within the shell.

$ which date
$ which cd
$ which help
/usr/bin/which: no help in (/home/shs/bin:.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/home/shs/bin:/opt/pash:/home/shs)

With no arguments, the which command stops looking when it finds the first march for the command name. Adding the -a option will get the command to show all of the executables when there is more than one.

$ which -a python

NOTE: The which command relies on your search path to determine where to look for whatever executable you ask about.

Cheat sheets

When you’re beginning your Linux journey, it’s also good to have what many call a “cheat sheet” on hand – a card, sheet of paper or file that provides very brief descriptions of a group of commands and how they work. For example, you will likely see descriptions such as these:

pwd			displays name of current directory (full pathname of your location on the filesystem)
ls			lists contents of current directory
ls –l			lists contents of current directory with extra details (e.g., permissions, ownerships, file size)
ls ~/*.txt		lists all files in your home directory ending in .txt
cd			change directory to your home directory
cd -			move into the last directory you were in before changing to wherever you are now
mkdir mydir		makes a directory called mydir
rmdir mydir		removes directory called mydir. mydir must be empty
touch myfile		creates a file called myfile. updating the timestamp on the file if it already exists
cp myfile myfile2	copies myfile to myfile2 (overwriting myfile2 if it already exists
rm myfile removes	file called myfile
rm –f myfile		removes myfile without asking for confirmation
cp –r dir newdir	copies the contents of dir to newdir. (the -r makes it recursive)
rm –rf mydir		delete directory mydir along with all OF its content without asking you for confirmation

To build your own cheat sheet, you can make a list of commands in a file and then use a script like that included in this post that pulls command descriptions from the help, whatis and man pages:

Building your personal Linux cheat sheets

Here’s a cheat sheet that I put together quite a while ago:

Linux command cheat sheet


Linux cheat sheets are commonly used by anyone coming up to speed on the Linux command line. You’ll probably find thousands of them if you type “Linux cheat sheet” into your browser’s search bar.

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