AI Hints
Home›Linux Tutorial›Help and Practice
Linux · Lesson 11 of 120

Getting Help

--help and man pages.

⏱ 2 min read▶ Video at 11:29🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

Nobody remembers every option of every command. Not even experts. Instead, they know how to ask the command itself for help. Linux has help built in, for almost everything.

Getting Help
From the video: Getting Help
  • Nobody remembers everything
  • Ask the command itself
  • Help is built in

dash dash help

Most commands understand dash dash help. It prints a short summary of how to use the command, and its options. Here's the help for who am I. It's short, and tells us there are only two options. Longer help pages scroll by, so we often only look at the top.

Terminal
whoami --help
Usage: whoami [OPTION]...
Print the user name associated with the current effective user ID.
Same as id -un.

      --help        display this help and exit
      --version     output version information and exit

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/whoami>
or available locally via: info '(coreutils) whoami invocation'

The manual

For the full story, there's the manual. Man, space, and the command name, opens its manual page. It explains everything, with examples. You scroll with the arrow keys, and press Q to quit. Here we print the first few lines of the manual for date.

Terminal
man date | head -12
libfaketime: In ft_shm_init(), sem_open failed and recreation attempts failed: Function not implemented
libfaketime: sem_name was /faketime_sem_21, created locally: false
libfaketime: In ft_shm_init(), sem_open failed and recreation attempts failed: Function not implemented
libfaketime: sem_name was /faketime_sem_21, created locally: false
grotty:<standard input>:(<standard input>):6: fatal error: 'V' command invalid before first 'p' command
man: command exited with status 1: (cd /usr/share/man && /usr/libexec/man-db/zsoelim) | (cd /usr/share/man && /usr/libexec/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE) | (cd /usr/share/man && preconv -e UTF-8) | (cd /usr/share/man && tbl) | (cd /usr/share/man && nroff -mandoc -rLL=87n -rLT=87n -Tutf8)

Other ways to get help

A few more tricks. Type dash dash help after any command first. It's quick. For a one line description, try what is. And for anything else, searching the web for the command name and what you want to do, almost always finds an answer.

keyvalue
--helpquick summary
manthe full manual
whatisone line description
The webcommand + what you want

Summary

Dash dash help gives a quick summary, and man opens the full manual. Press Q to leave it. Next, let's practise everything so far.

Key takeaways
  • command --help
  • man command
  • q to quit
Next up: Practice: First Commands — a warm up