Unix

From Rizzo_Lab
(Redirected from Unix Tutorial)
Jump to: navigation, search

A great Unix tutorial is here http://www.ee.surrey.ac.uk/Teaching/Unix/


Looking at your environment

pwd            print the current location
ls             list the contents of the current location

Moving around

mkdir          create a new directory
rmdir          remove a diretory
cd             go to a location by specifying the directory

Modifying your environment with files

vim            create a new file or edit an existing file
rm             remove a file/directory
cp             copy a file/directory
mv             move a file/directory or change the name of a file/directory

More commands

man            instructions for using commands
cat            print contents of a file
more           view contents of a file
diff           show the difference between two files
grep           search within a file for specific text
chmod          change permission of a file or directory
whoami         shows your username
clear          clear the screen
ssh            log on to a different computer
scp            copy files to/from a different computer
tcsh           execute a C shell (tcsh) script
bash           execute a Bourne-Again Shell (bash) script
ps -fu         see current processing commands
logout/exit    logout of a computer

Other things to know

./             shortcut for 'current directory'
../            shortcut for 'parent directory'
~/             shortcut for 'home directory'
>              print something to a file
>>             append something to a file
*              shortcut for 'any strings of characters'
|              chain commands
&              run stuff in the background
\              escape a character

Keyboard shortcuts

<tab>          auto-complete
<up arrow>     see command history
<Ctrl+c>       interrupt a process
<Ctrl+d>       logout

Queuing commands for SLURM (Seawulf only)

sbatch            submit a job to the queue
squeue            check on jobs in the queue
scancel           delete a job from the queue