Linux Basics: Getting Help for Commands
You do not need to memorize every Linux command option. Debian and Ubuntu include several ways to ask a program or the shell for help. These examples assume you are using Bash.
Start with a short summary
ls --help
cp --helpMany GNU commands accept --help. It prints a usage summary, describes options, and exits without carrying out the command’s usual job. Here, cp --help does not copy any files.
Look at the usage line first. Items in square brackets are optional. An argument such as FILE or SOURCE is a placeholder to replace with a real path, not a word to type literally.
--help is common, but it is not universal. Check a command’s documentation rather than assuming every program follows the same convention.
Ask Bash about built-in commands
help cd
help pwdSome commands are built into the shell. Bash’s help command explains these built-ins, including their options and exit statuses. It does not provide help for arbitrary external programs.
Check which command Bash will use
type cd
type ls
type -a pwdExample in default Bash after the commands above, with PATH=/usr/bin:/bin. Aliases, functions, and search paths can change the result:
cd is a shell builtin
ls is hashed (/usr/bin/ls)
pwd is a shell builtin
pwd is /usr/bin/pwd
pwd is /bin/pwdtype identifies a command as a built-in, alias, function, or executable. type -a lists all matching definitions and executable locations that Bash finds. This is useful when a familiar command behaves differently in another terminal.
For longer documentation, use man ls if the manual reader and that command’s manual page are installed. In the usual pager, press q to return to the terminal.
Reference
Acknowledgements
This post was created with assistance from AI.
Linux Basics — lesson 2 of 25. Series index
Previous: Moving Around the Terminal · Next: Reusing Bash Command History