###Unix###


files and directories


cp <x> <y> % copy <x> to <y>

mv <x> <y> % move <x> to <y>

mkdir <x> % makes new directory <x>

pwd %shows current directory

cd <x> % goes into folder <x>

rm <x> % remove file <x>

ln -s <x> <y> % makes a soft link between real file <x> and local pointer <y>

ls % lists documents in current directory

cat <file> % list the whole file

more <file> % types <file> in chunks, <space> goes to next chunk

less <file> % similar to more

head <file> % types the first N lines

tail <file> % types the last N lines

find * % list all of the files

Process management

CTL-Z % pause the current process and return to console

bg % allow the process you just paused to run in background

jobs % shows what you're running

ps % shows processes 


<c> > file % output of command c goes to file <file>

<c> >& file % errors from command c goes to file <file>

<c> >> file % appends output of <c> onto end of <file>

<c> >>& file % appends error of <c> onto end of <file>

Help


man <c> % help on command <c>

<c> -h % sometimes has help this way as well


special startup/config files


.login or .profile % runs on login

.shrc or .cshrc % runs when you invoke a script

editing and strings


sed s/<a>/<b>/ <file> > 

grep <a> <b> % print out all lines in  <b> which contain string <a>

sort <a> % sort the file a

diff <a> <b> % print out the difference between <a> and <b>

xemacs <a> % edit the file <a>

environmentals


This depends on what shell you are using

In the bash shells scripts use

export <X>=<y> % will make $X refer to <y>

export PATH=<y>:${PATH} %will append <y> to $PATH


In the c-shells csh and tcsh 

setenv <x> <y> is the same thing as export <x>=<y>

env % will list all environmentals you have set

echo $ENV % will print the value of $ENV to the terminal

important environmentals are:


$HOST

$USER

$HOME % your home area

$PWD              % the current directory

$PATH              % where unix looks for code to execute

$PYTHONPATH % where unix looks for python modules to import

$LD_LIBRARY_PATH % where unix looks for shared libraries


you normally want to append to the PATH. Just setting them to <x> 

wipes out all the other stuff they were already set to.