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:
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.
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.
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
helpprints it.type cdtells you that cd is a builtin. -
There is no cd file: it is a builtin, and its code lives inside Bash itself.
type cdshows 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.