1. Computing & Technology

Discuss in my forum

Five Essential Linux Operators for Newbies

Basic operators for interacting with files

By , About.com Guide

1. Run a program as a background process with "&"

The ampersand operator ("&") is used to specify that a process should be executed in the background, that is, after you type in a command followed by a "&", the shell does not wait for the process to finish. Instead it goes to the next line and presents a prompt for you to type the next command. For example, run_backup & executes the program "run_backup" as a background process.

2. Redirect the output of a program with ">"

The "greater than" operator (">") redirects the output of a process to a file. For example cat readme > temp sends the content of the file "readme" to the file "temp". That is, it creates a file "temp" and writes the output of the cat command to it. If the file "temp" already exists it will be overwritten. The ">>" operator appends to the file.

3. Link two processes with the pipe operator "¦"

Instead of sending the output of a process to a file with redirect operator ">", you can pass it to another process as input using the pipe operator "¦". For example, cat readme | more will send the output of the cat readme command to the more program.

4. Specify your home directory with the tilde character "~"

Since people frequently access their home directory, there is a shortcut for specifying the current user's home directory in a directory path. Whatever your actual home directory in the Linux file system is (typically /home/jdoe if your username is jdoe), the tilde character "~" can be used as substitute. For example, the command cd ~/mp3s changes the current directory to the "mp3s" subdirectory in your home directory, assuming it exists.

5. Specify a set of files with the star character "*"

With the star character "*", also called wild card you can select a set of files that have part of their file name or directory path in common. For example, the command ls *.mp3 lists all files in the current directory that end with ".mp3".

©2012 About.com. All rights reserved.

A part of The New York Times Company.