Understanding command syntax -1
A lot of commands in Linux have one or more options that you can add to change the behavior of the command. Generally, options consist of a single letter, preceded by a hyphen. However, you can group single-letter options together or precede each with a hyphen, to use more than one option at a time.
For example, the following two uses of options for the ls command are the same:
$ ls -l -a -t
$ ls -lat
In both cases, the ls command is run with the -l (long listing), -a (show hidden dot files), and -t options (list by time).
Some commands include options that are represented by a whole word. To tell a command to use a whole word as an option, you precede it with a double hyphen (--). For example, to use the help option on many commands, you enter --help on the command line. Without the double hyphen, the letters h, e, l, and p would be interpreted as separate options. (There are some commands that don’t follow the double hyphen convention, using a single hyphen before a word, but most commands will use double hyphens for word options.)
Many commands also accept arguments after certain options are entered or at the end of the entire command line. An argument is an extra piece of information, such as a filename, directory, username, device, or other item that tells the command what to act on. For example, cat /etc/passwd displays the contents of the /etc/passwd file on your screen. In this case, /etc/passwd is the argument. Usually, you can have as many arguments as you want on the command line, limited only by the total number of characters allowed on a command line.
Comments
Post a Comment