Difference between revisions of "Linux"

From PHYSpedia
Jump to: navigation, search
(Useful Commands)
(Useful Commands)
Line 21: Line 21:
 
;<code>sort</code>
 
;<code>sort</code>
 
: read from stdin, sort lines, and write to stdout
 
: read from stdin, sort lines, and write to stdout
: command options: -k, -t, -n, -g
+
: common options: -k, -t, -n, -g
 
;<code>cut</code>
 
;<code>cut</code>
 
: read from stdin and write selected columns to stdout.
 
: read from stdin and write selected columns to stdout.
Line 28: Line 28:
 
: read from stdin and write to stdout such that columns are aligned
 
: read from stdin and write to stdout such that columns are aligned
 
: common options: -t
 
: common options: -t
 +
;<code>head [file]</code>
 +
: read from stdin, or from a file, and print the first 10 lines
 +
: useful for taking a peak at the contents of a large file
 +
: useful for limitng the output of a pipeline
 +
: common options: -n
 +
;<code>tail [file]</code>
 +
: read from stdin, or from a file, and print the last 10 lines
 +
: similar uses to head
 +
: can be used with head to print a single line, or range of lines, in a file
 +
: common options: -n

Revision as of 22:08, 21 January 2013

These topics have their own pages.

Getting Started

Scripting

Gnuplot

Common C, C++, FORTRAN Libraries

Useful Commands

The following is a (short) list of useful command when manipulating data in text files. Some common options are listed, but may not be explained. For full descriptions of each command, see the man page. stdin, stdout, and stderr refer to standard input, output and error, respectively.

cat [file1 [ file2 [...] ] ]
print text file(s) to stdout. if multiple files are given, their text is concatenated
useful for starting a pipeline of commands from the contents of a text file
echo [args...]
print arguments to stdout
useful for starting a pipeline of commands from a variable's value
useful for printing output to the terminal from inside a script
sort
read from stdin, sort lines, and write to stdout
common options: -k, -t, -n, -g
cut
read from stdin and write selected columns to stdout.
common options: -d, -f
column
read from stdin and write to stdout such that columns are aligned
common options: -t
head [file]
read from stdin, or from a file, and print the first 10 lines
useful for taking a peak at the contents of a large file
useful for limitng the output of a pipeline
common options: -n
tail [file]
read from stdin, or from a file, and print the last 10 lines
similar uses to head
can be used with head to print a single line, or range of lines, in a file
common options: -n