pete > guides > linux > commands


This page enumerates, categorizes, and very briefly describes a bunch of Linux command-line programs that you may find useful. The documentation provided here is (intentionally) insufficient to actually use them; recall that you can use the man command to read the online manual page (arrow keys and pgup/pgdn scroll, 'q' to exit). Therefore, to read about all the options accepted by the ls program, run

$ man ls

Some of the programs below are standard, as part of the "coreutils" and "util-linux" packages in Arch Linux; others will need to be installed separately.

Vocabulary

Commands


The single most important one

The second most important one, for system administration

Get me outta here

Basic filesystem stuff

Text analysis

Text manipulation

More complex file stuff

Measuring and monitoring

Miscellaneous

Network

More complex

Playing with input and output


Most of the aforementioned commands print output to the screen. Many of them can accept input from the keyboard.

You can save the output of a program in a file with the ">" operator. The following shell command will cause the output of ls -ltr to be saved in the file named foo:

$ ls -ltr > foo

Likewise, you can provide a file as input to a program with the "<" operator. This is exactly equivalent to running the program and typing the contents of the file at the program directly. The following shell command will cause the contents of the file bar to be fed to the program my-guessing-game as if they had been typed by a user using the keyboard:

$ ./my-guessing-game < bar

Furthermore, you can use the "|" operator (called a "pipe") to pass the output of a program directly to another program as input:

$ ls -ltr | ./my-guessing-game

To be more precise with the above, the ">" redirection causes the standard output (stdout, file descriptor 1) to refer to the named file; the "<" redirection causes standard input (stdin, file descriptor 0) to refer to the named file; and the "|" operator to affect stdout of the preceding program and stdin of the succeeding program. If you want to redirect standard error (stderr, file descriptor 2), use "2>".

More information on redirection can be found in the Advanced Bash-Scripting Guide.

Last modified: