What’s a Command?
A Linux command typically consists of a program name followed by options and arguments, typed within a shell. The program name refers to a program somewhere on disk (which the shell will locate and run). Options, which usually begin with a dash, affect the behavior of the program, and arguments usually represent inputs and outputs. For example, this command to count the lines in a file:
$ wc -l myfile
consists of a program (wc, the “word count” program), an option (-l) saying to count lines, and an argument (myfile) indicating the file to read. (The dollar sign is a prompt from the shell, indicating that it is waiting for your command.) Options may be given individually:
$ myprogram -a -b -c myfile Three individual optionsor combined behind a single dash:
$ myprogram -abc myfile Same as -a -b -cthough some programs are quirky and do not recognize combined options.
Commands can also be much more complex than running a single program:
They can run several programs at once, either in sequence (one after the other) or connected into a “pipeline” with the output of one command becoming the input of the next.
Options are not standardized. The same option (say,
-l) may have different meanings to different programs: inwc -lit means “count lines of text,” but inls -lit means “produce longer output.” In the other direction, two programs might use different options to mean the same thing, such as-qfor “run quietly” versus-sfor “run silently.”Likewise, arguments are not standardized. ...