← All lessons
Command line basics · Lesson 5 of 7

Getting help and saving keystrokes

Every standard command has a manual page. man ls opens the one for ls: what it does, then every option. It opens in less, so / searches and q quits. For a quicker summary, most commands take --help: cp --help.

Press Tab while typing a name and the shell finishes it for you. If there's more than one match, press Tab twice to see them all. Tab saves typing, and it saves typos: if Tab won't complete a name, the name probably isn't there.

The shell remembers what you've typed. The Up arrow brings back the last command (press it again for earlier ones), and history lists them with numbers. Ctrl+R searches back through them: press it and type part of an old command.

A few keys to know: Ctrl+C stops the command that's running. Ctrl+L (or clear) clears the screen. Ctrl+D on an empty line logs out of the shell, like exit.

Copy and paste in most terminals is Ctrl+Shift+C and Ctrl+Shift+V, because plain Ctrl+C already means stop.

When a command fails, read the message. No such file or directory means a wrong name or path, Permission denied means you're not allowed (the next course covers why), and command not found usually means a typo or a program that isn't installed.

Practice

Open the manual page for the cp command.

More info

Quick reference

man cmdThe manual page. `q` quits.
cmd --helpA short summary of the options.
Tab, Tab TabFinish a name; list the matches.
Up, Ctrl+R, historyEarlier commands; search them; list them.
Ctrl+CStop the running command.
Ctrl+L, clearClear the screen.

The other Linux courses