Anatomy of a Unix Command
A basic UNIX command has 3 parts. These are:
command name
options (zero or more)
arguments (zero or more)
In general, UNIX commands are written as single strings followed by the return key. Note that UNIX commands are case-sensitive, i.e. it does matter whether you type a letter in uppercase or lowercase.
Example
The example above has the following components:
the command name (wc)
one option (-l)
one argument (myfile.txt)
Options
Also called “switches” or “flags”.
Specify the way a given commands must work.
Preceded by one or two dashes (one dash if the switch is a single character, two dashes otherwise).
Tab completion
Tab completion is a useful features of UNIX where the shell automatically fills in partially typed commands when the tab key is used. This is advantageous in many ways:
Commands or filenames with long or difficult spelling require fewer keystroke to reach
In the case of multiple possible completions, the shell will list all filenames beginning with those few characters.
History
Another useful feature is the fact that the shell remembers each typed command, so you can easily recall and run previous commands.
By using the up and down arrows at the prompt, you can revisit the command history and recall previously typed commands.
Previous commands can be re-executed as they are or can be edited using the left/right arrow.
Use the history command to specify how many and which previous commands to display.
Examples:
Last updated