Syntax of UNIX Command Lines
UNIX command lines can be simple, one-word entries like the date command. They can also be more complex: you may need to type more than the command name.
A UNIX command may or may not have arguments. An argument can be an option or a filename. The general format for UNIX commands is:
command option(s) filename(s)
There isn’t a single set of rules for writing UNIX commands and arguments, but you can use these general rules in most cases:
Enter commands in lowercase.
Options modify the way in which a command works. Options are often single letters prefixed with a dash (-) and set off by any number of spaces or tabs. Multiple options in one command line can be set off individually (like -a -b), or, in some cases, you can combine them after a single dash (like -ab).
Some commands, including those on Linux systems, also have options made from complete words or phrases, like --delete or --confirm-delete. When you enter a command, you can use this option style, the single-letter options (which all start with a single dash), or both.
The argument filename is the name of a file that you want to use. If you don’t enter a filename correctly, you may get the response "filename: no such file or directory” or "filename: cannot open.”
Some commands, like telnet and who (shown earlier in this chapter), have arguments that aren’t filenames.
You must type spaces between commands, options, and filenames.
Options come before filenames.
Two or more commands can be written ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access