Getting Help
Getting help means asking a command to describe itself. Every command carries its own short guide.
A short guide
Whoami prints a short guide when --help follows it.
$ whoami --helpEcho has no short guide
Echo prints --help back as plain words.
$ echo --helpHelp for a built-in command
Help prints a one-line guide for echo.
$ help -d echoA short description from man
Man prints a short description of ls.
$ man -f lsExample
$ help -d echo
$ whoami --helpKey points
- An option is an extra word after a command that changes how it runs.
- A flag is a short option that starts with a dash, like -h.
- An argument is the main word that a command acts on.
- Use --help after a command to print its short guide.
- A built-in command is a command that lives inside the shell.
- Use help to read a short guide for a built-in command.
- A manual is a built-in guide that describes one command in full.
- Use man to open the manual for a command.
- Echo has no --help guide of its own, so help echo is the way to read about echo.
In this example, two lines ask for two guides. The first line asks help for a one-line guide to echo. The second line asks whoami for its short guide. The short guide names what whoami does and lists its options.
Note
Man opens a long guide, and --help prints a short one.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
How do you print the short guide for whoami?