Linux Labs

First steps / Stage 14 of 15

Help and the shell

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · on a machine · 6 min

Help on a command

Someone else's command has an option you do not know. The help built into the terminal tells you what it does.

type tells you where to look for help. Most programs that are files have short help behind the --help option and a full man page. Bash builtins have no file of their own; the help command describes them:

bash
cp --help    # short: how to call it and the list of options
man cp       # the manual, paged like in less
help cd      # help on a Bash builtin

man opens the manual in less: search with /, next match with n, quit with q, as in the lesson "Working comfortably in the terminal". The SYNOPSIS section shows how to call the command; square brackets there mean "optional" and are not typed. The options are described further down: in the OPTIONS section for grep, right in DESCRIPTION for cp.

Each program decides what its options mean: cp -v tells you in more detail what it copies, while nginx -v prints the version. So look an option up in the help of the command it belongs to.

Exercise · look

Look an option up in the manual

Open the grep manual and find the description of -v: type /-v, and press Enter. Search in man ignores case, so the -V line comes up first; n moves to the next match. Read the description, leave with q and try the option on the log ~/shell-lab/service.log.

First, predict

What does the -v option do in grep?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

man cd prints No manual entry for cd. What do you do to find help on cd?

  • Help for builtins already ships inside Bash, and help prints it. type cd tells you that cd is a builtin.

  • There is no cd file: it is a builtin, and its code lives inside Bash itself. type cd shows exactly that.

  • cd works — you have used it all course long. A command that exists can still have no man page.

cd is a shell builtin, and help cd prints its help.

Ubuntu 24.04
Loading…