Difference between revisions of "Unix"

From Rizzo_Lab
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
A great Unix tutorial is here http://www.ee.surrey.ac.uk/Teaching/Unix/
 
A great Unix tutorial is here http://www.ee.surrey.ac.uk/Teaching/Unix/
  
Linux Basics https://help.ubuntu.com/6.06/ubuntu/desktopguide/C/linux-basics.html
 
 
==Resources==
 
[[Image:Linux-101-Hacks.pdf]]
 
  
 
==Looking at your environment==
 
==Looking at your environment==
 
  pwd            print the current location
 
  pwd            print the current location
  ls            ls the contents of the current location
+
  ls            list the contents of the current location
  
 
==Moving around==
 
==Moving around==
Line 26: Line 22:
 
  more          view contents of a file
 
  more          view contents of a file
 
  diff          show the difference between two files
 
  diff          show the difference between two files
  grep          search within a file fore specific text
+
  grep          search within a file for specific text
 
  chmod          change permission of a file or directory
 
  chmod          change permission of a file or directory
 
  whoami        shows your username
 
  whoami        shows your username
Line 32: Line 28:
 
  ssh            log on to a different computer
 
  ssh            log on to a different computer
 
  scp            copy files to/from a different computer
 
  scp            copy files to/from a different computer
  tcsh          execute a shell script
+
  tcsh          execute a C shell (tcsh) script
 +
bash          execute a Bourne-Again Shell (bash) script
 
  ps -fu        see current processing commands
 
  ps -fu        see current processing commands
 
  logout/exit    logout of a computer
 
  logout/exit    logout of a computer
Line 53: Line 50:
 
  <Ctrl+d>      logout
 
  <Ctrl+d>      logout
  
==Queuing commands for PBS (Seawulf only)==
+
==Queuing commands for SLURM (Seawulf only)==
  qsub          submit a job to the queue
+
  sbatch            submit a job to the queue
  qstat          check on jobs in the queue
+
  squeue            check on jobs in the queue
  qdel           delete a job from the queue
+
  scancel           delete a job from the queue

Latest revision as of 21:28, 22 January 2020

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