noaa NOAA / NESDIS / National Geophysical Data Center / WDC for SEG, Boulder, Colorado USA noaa
banner
next  up  previous
Next: TextEditors Up: Getting Started Previous: Wildcards

UNIX commands

Now we briefly describe essential UNIX commands.
 

Usage: awk [options] [file(s)] [Standard I/O]

Description: There are whole books on this program. We will use awk in a very primative way to select specific columns from standard input for use as input into another program. For example, if the third and fourth column of file myfile is desired as input to program myprog type:

% awk '{print $3, $4 }' myfile | myprog
 

Usage: cat [options][file(s)] [Standard I/O]

Description: concatinates and displays files. It reads from standard input or from the specified file(s) and displays them to standard output.
 

Usage: cd [directory]

Description: changes directory from current directory to the one specified.
 

Usage: cp [file1] [file2]

Description: copies files or directories.
 

Usage: grep [options] [expression] [file(s)]

Description: grep, like awk, is a very versatile (and complicated) program about which one could read an entire book. However, we will use grep in a primative way, to pick out particular key strings from a file. For example, if a file myfile contains lines of data for many samples, and we wish to consider the data for a single sample mysamp, lines containing the word mysamp can be ``grepped'' out by:

% grep ``mysamp'' myfile

and listed to the screen, redirected to a file, or piped to a program.
 

Usage: join [options] file1 file2

Description: file1 and file2 share a common ``join'' field, by default the first column. This could for example be a sample name. The output file prints the join field, followed by the rest of the line from file1, then the rest of the line in file2. Say file1 has magnetometer output data, with lines of data containing: sample, treatment, D, I, M and file2 has pertinent information such as sample orientation, with lines: sample, azimuth, plunge. We may wish to attach the sample orientation data to the magnetometer output for further processing. join allows us to do this by the following:

% join file1 file2
 

Usage: ls [options] [directory name]

Description: lists the contents of the specified directory. If none specified, lists the current directory.
 

Usage: mkdir [directory name]

Description: makes a directory with the specified name.
 

Usage: more [file name]

Description: lists the contents of a file page by page.  To advance the page, press the space bar.  To view line by line, press
return.

Usage: mv [file1 file2]

Description: renames file1 to file2. This also works for directory names.
 

Usage: paste [options] [file1 file2]

Description: concatenates lines from file2 onto the corresponding line in file1.
 

Usage: pwd

Description: prints the absolure pathname of the working (or current) directory.
 

Usage: rm [options] [file(s)]

Description: Deletes the specified file or files.
 

Usage: rmdir [options] [file(s)]

Description: Deletes the specified directories. Note: the directory has to be empty.
 

Usage: tee   [file name] ...

Description: tee transcribes the standard input to the standard output and copies the input to the filename.
 

More detailed descriptions are usually available on-line with the man command. For example, to find out more about cat, type:

% man cat

and read all about it.


For content questions please contact: Lisa Tauxe

Scripps Institution of Oceanography
La Jolla, CA 92093-0220, USA
Phone: (+1.619) 534-6084
Fax: (+1.619) 534-0784
NOAA>NESDIS>NCEI>Geomagnetism