help

Linux has some great built-in tools to help you how to use a command or check what flags are available for a command. One tool, help, is a built-in bash command that provides help for other bash commands (echo, logout, pwd, etc).

$ help echo

This will give you a description and the options you can use when you want to run echo. Note that help only works on built-ins, so help ls won’t work, because ls is a separate program rather than something built into the shell.

For other executable programs, it’s convention to have an option called --help or something similar.

$ ls --help

Don’t expect this to work on built-ins though. Since the shell handles them itself, echo --help won’t print any help, it will just echo the text --help back at you.

Not all developers who ship out executables will conform to this standard, but it’s probably your best shot to find some help on a program.

Exercise

Run help on the echo command, logout command and pwd command.

Quiz Question

How do you get quick command line help for built-in bash commands?

Show answer

help