Skip to Main Content
Linux Pocket Guide
book

Linux Pocket Guide

by Daniel J. Barrett
February 2004
Beginner content levelBeginner
200 pages
5h 40m
English
O'Reilly Media, Inc.
Content preview from Linux Pocket Guide

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 options

or combined behind a single dash:

$ myprogram -abc myfile               Same as -a -b -c

though 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: in wc -l it means “count lines of text,” but in ls -l it means “produce longer output.” In the other direction, two programs might use different options to mean the same thing, such as -q for “run quietly” versus -s for “run silently.”

  • Likewise, arguments are not standardized. ...

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.
Start your free trial

You might also like

Linux Pocket Guide, 2nd Edition

Linux Pocket Guide, 2nd Edition

Daniel J. Barrett
Linux in a Nutshell, 6th Edition

Linux in a Nutshell, 6th Edition

Ellen Siever, Stephen Figgins, Robert Love, Arnold Robbins

Publisher Resources

ISBN: 9780596806347Errata Page