Learning materials

Linux Shell Commands

Basic LINUX/UNIX shell commands

Files and Folders

~home directory

.present working directory

Environment

~/.bash*files that define the environment

Interpreters and Compilers

awk

C-like stream processing language

env

print the environment variables

sed

stream line editor

cd

change directory

export

define and inherit environment variable

bc

arbitrary precision calculator language

pwd

print path to present working dir

set

set or unset shell options

python

MatLab-like programming language

ls

list directory content

whereis

locate commands and manpages

gfortran

GNU FORTRAN-Compiler

mkdir

create a new folder

which

locate commands

gcc

GNU C-Compiler

rmdir

remove an existing folder

alias

define abbreviations for commands

make

compiling and processing utility

rm

remove files and folders

function

more complex abbreviations

 

 

chmod

change file status

 

 

Print commands

chown

change file owner

Job and Process Control

echo

unformatted printout

ln

create link to file or folder

jobs

list of active jobs in a terminal

printf

formatted printout

cp

copy

fg#

get job # to the foreground

 

mv

move

bg#

send job # to the background

Online Help

find

find

CTRL–c

Cancel the job in the foreground

man

display manual page (troff processor)

locate

simple version of find

CTRL-z

Pause the job in the foreground

help

bash command to display help

du

print directory usage (file sizes)

… &

Start a job in the background

info

GNU-related help

df

print file system disk space

top, ps

list of processes on a computer

 

touch

change time stamp of a file

kill #

terminate process #

Commands

 

 

 

history

display cmd buffer

File Content

 

!#

repeat cmd number #

cat

print file content(s) to stdout

Input and Output Redirection

!char

repeat last cmd starting with char

more

print file content page by page

…|…

pipe stdout to the next command

A command is often followed by an argument, and its behavior can be refined with options.

The most general syntax is:

command [options] [arguments]

Options typically start with (occasionally +), e.g., ls –a –l folder

Most commands have default arguments, e.g., the default of folder is the present working directory. Most options (especially flags that require no arguments) can be written together

ls –al

less

scroll through file content

> file

redirect stdout to file

cut

cut columns from a file

>> file

append stdout to file

vi, vim

programmers text editor

>& file

redirect stdout and stderr to file

wc

count words (lines, characters...)

2> file

redirect stderr to file

grep

scan files for certain content

( … )

group stdout and stderr

diff

print differences between two files

<<END … END

redirectto stdin

sort

sort lines of files

tee

duplicate stdout and route to file

head

print first lines of a files

 

 

tail

print last lines of a file

Archives

tac

print file content(s) backwards to stdout

tar, gzip , gunzip, bzip2

 

 

SEG-Y Trace Header Format

#Byte positionTypeSEG Y*SU**1001 - 0044Trace sequence number within linetracl2005 - 0084Trace sequence number within reeltracr3009 - 0124Original field record numberfldr4013 - 0164Trace sequence number within original field recordtracf5017 - 0204Energy source point numberep6021 - 0244CDP ensemble numbercdp7025 - 0284Trace sequence number within CDP ensemblecdpt8029 - 0302Trace identification code:
-1 = Other
0 = Unknown
1 = seismic data
2 = dead
3 = dummy
4 = time break
5 = uphole
6 = sweep
7 = timing
8 = water break
9 = Near-field gun signature
10 = Far-field gun signature
11 = Seismic pressure sensor
12 = Multicomponent seismic sensor - Vertical component
13 = Multicomponent seismic sensor - Cross-line component
14 = Multicomponent seismic sensor - In-line component
15 = Rotated multicomponent seismic sensor - Vertical component
16 = Rotated multicomponent seismic sensor - Transverse component
17 = Rotated multicomponent seismic sensor - Radial component
18 = Vibrator reaction mass
19 = Vibrator baseplate
20 = Vibrator estimated ground force
21 = Vibrator reference
22 = Time-velocity pairs
23+ = optional use
(SU: 111 = complex FD, i.e. alternating samples of real and imag,
116 = real, 117 = imag, 118 = amp, 119 = phase)trid9031 - 0322Number of vertically summed traces yielding this tracenvs10033 - 0342Number of horizontally stacked traces yielding this tracenhs11035 - 0362Data use (1 = production, 2 = test)duse12037 - 0404Distance from source point to receiver groupoffset13041 - 0444Receiver group elevationgelev14045 - 0484Surface elevation at sourceselev15049 - 0524Source depth below surfacesdepth16053 - 0564Datum elevation at receiver groupgdel17057 - 0604Datum elevation at sourcesdel18061 - 0644Water depth at sourceswdep19065 - 0684Water depth at receiver groupgwdep20069 - 0702Scalar for elevations and depths (+ = multiplier, - = divisor)scalel21071 - 0722Scalar for coordinates (+ = multiplier, - = divisor)scalco22073 - 0764X source coordinatesx23077 - 0804Y source coordinatesy24081 - 0844X receiver group coordinategx25085 - 0884Y receiver group coordinategy26089 - 0902Coordinate units
1 = Length in meters or feet
2 = arc seconds
3 = decimal degrees
4 = degrees, minutes, secondscounit27091 - 0922Weathering velocitywevel28093 - 0942Subweathering velocityswevel29095 - 0962Uphole time at sourcesut30097 - 0982Uphole time at receiver groupgut31099 - 1002Source static correctionsstat32101 - 1022Receiver group static correctiongstat33103 - 1042Total static appliedtstat34105 - 1062Lag time between end of header and time break in millisecondslaga35107 - 1082Lag time between time break and shot in millisecondslagb36109 - 1102Lag time between shot and recording start in millisecondsdelrt37111 - 1122Start of mute timemuts38113 - 1142End of mute timemute39115 - 1162Number of samples in this tracens40117 - 1182Sample interval of this trace in microsecondsdt41119 - 1202Field instrument gain type code:
1 = fixed
2 = binary
3 = floating point
4+ = optional usegain42121 - 1222Instrument gain constantigc43123 - 1242Intrument early gain in decibelsigi44125 - 1262Correlated (1 = no, 2 = yes)corr45127 - 1282Sweep frequency at startsfs46129 - 1302Sweep fequency at endsfe47131 - 1322Sweep length in millisecondsslen48133 - 1342Sweep type code:
1 = linear
2 = parabolic
3 = exponential
4 = otherstyp49135 - 1362Sweep taper trace length at start in millisecondsstas50137 - 1382Sweep taper trace length at end in millisecondsstae51139 - 1402Taper type code:
1 = linear
2 = cosine squared
3 = othertatyp52141 - 1422Alias filter frequencyafilf53143 - 1442Alias filter slopeafils54145 - 1462Notch filter frequencynofilf55147 - 1482Notch filter slopenofils56149 - 1502Low cut frequencylcf57151 - 1522High cut frequencyhcf58153 - 1542Low cut slopelcs59155 - 1562High cut slopehcs60157 - 1582Year data recordedyear61159 - 1602Day of yearday62161 - 1622Hour of day (24-hour clock)hour63163 - 1642Minute of hourmin64165 - 1662Second of minutesec65167 - 1682Time basis (1 = local, 2 = GMT, 3 = other)timbas66169 - 1702Trace weighting factor for fixed-point format datatrwf67171 - 1722Geophone group number of roll switch position onegrnors68173 - 1742Geophone group number of first trace of original field recordgrnofr69175 - 1762Geophone group number of last trace of original field recordgrnlof70177 - 1782Gap size (total number of groups dropped)gaps71179 - 1802Overtravel associated with taper (1 = down/behind, 2 = up/ahead)otrav72181 - 1844X cdp coordinated173185 - 1884Y cdp coordinatef174189 - 1924In-line numberd275193 - 1964Cross-line numberf276197 - 2004SP numberungpow77201 - 2044unscale78205 - 2062mark79207 - 2082mutb80209 - 2124dz81213 - 2164fz82217 - 2182n283219 - 2202shortpad84221 - 2244ntr77201 - 2022SP number scalar (applies to #76)78203 - 2042Trace value measurement unit:
-1 = Other (should be described in Data Sample Measurement Units Stanza)
0 = Unknown
1 = Pascal (Pa)
2 = Volts (V)
3 = Millivolts (mV)
4 = Amperes (A)
5 = Meters (m)
6 = Meters per second (m/s)
7 = Meters per second squared (m/s2)
8 = Newton (N)
9 = Watt (W)79205 - 2106Transduction constant80211 - 2122Transduction Units
-1 = Other
0 = Unknown
1 = Pascal (Pa)
2 = Volts (V)
3 = Millivolts (mV)
4 = Amperes (A)
5 = Meters (m)
6 = Meters per second (m/s)
7 = Meters per second squared (m/s2)
8 = Newton (N)
9 = Watt (W)81213 - 2142Device Identifier82215 - 2162Scalar for times and statics (applies to #29-39)83217 - 2182Source Type/Orientation
-1 = Other
0 = Unknown1 = Vibratory - Vertical orientation
2 = Vibratory - Cross-line orientation
3 = Vibratory - In-line orientation
4 = Impulsive - Vertical orientation
5 = Impulsive - Cross-line orientation
6 = Impulsive - In-line orientation
7 = Distributed Impulsive - Vertical orientation
8 = Distributed Impulsive - Cross-line orientation
9 = Distributed Impulsive - In-line orientation84219 - 2246Source Energy Direction85225 - 2306Source Measurement86231 - 2322Source Measurement Unit
-1 = Other
0 = Unknown
1 = Joule (J)
2 = Kilowatt (kW)
3 = Pascal (Pa)
4 = Bar (Bar)
4 = Bar-meter (Bar-m)
5 = Newton (N)
6 = Kilograms (kg)87233 - 2406unassigned - for optional information

*The SEG Y trace header length is 240 bytes. The original SEG Y definition (rev 0) leaves the trace header positions 181-240 unformatted and unassigned for optional storage of information (Barry et al., 1975, Recommended Standards for Digital Tape Formats, Geophysics 40(2), 344-352). A revision to this standard extended the assigned header, leaving only bytes 233-240 for optional information (SEG Technical Standards Committee, 2002, SEG Y rev 1 Data Exchange format, Technical Standard Report, 45 pp).
Revision 1 also extended the reel/file header to previously unassigned positions. In the new standard, the byte positions 3501-3506 are used to store information about the format (rev 0 or 1), variable trace length (not permitted in rev 0), and the number of extended textual file headers (non-existent in rev 0). Note that the new interpretation may result in backward incompatibility.
**Header Mapping to Seismic Unix. Beyond byte position 180 the interpretation between SEG Y and SU differs (grey). This may lead to problems in SU, which can be avoided using segyclean to erase the header positions 181-210.