Linux Commands


COMMAND SUMMARY EXAMPLE
ls lists the contents of the directory ls
cd changes directory
cd games will move you into the local directory games/
cd .. will move you back one directory
cd /home/fri/ specify the entire path to move to a non-local directory
vi vi POSCAR Edit the file POSCAR
To exit after editing press esc then :wq + return
See more about editing files here
more more POSCAR Shows the contents of a file. Press space to see the rest of the file if a percentage appears at the bottom
mkdir creates a new directory
mkdir games creates the directory games/ in the current directory
rm deletes a file or directory
rm INCAR deletes the file INCAR
rm -r work/ deletes the directory work/ and everything in it
cp copies a file or directory
cp INCAR INCAR_save copies file INCAR to a new file INCAR_save
cp INCAR ../run2/ copies file INCAR into a directory named run2/
cp -r work/ proj1/ copies entire directory work/ to a new or existing directory proj1/
scp copies a file or directory between machines
scp INCAR user@fri.oden.utexas.edu:pt32/ copies file INCAR from local machine to the pt32 directory on fri
scp user@fri.oden.utexas.edu:INCAR . copies file INCAR from /home/user/fri/ to current dir
mv moves/renames a file or directory
mv CONTCAR POSCAR renames the file CONTCAR to a new file POSCAR
mv run1/ ../../ move directory run1/ back two directories
mv work/ proj1/ renames directory work/ to proj1/
grep searches files for text
grep It OUTCAR return all lines with It in the file OUTCAR
grep "call project()" * returns all instances of phrase call project
in any file in the current directory
man Linux manual for any command
man grep will give detailed information on the grep command
use return to scroll and type q to exit
clear used to clear the prompt clear
ssh used to connect to a remote host
ssh bob@fri.oden.utexas.edu attempts to connect user bob
to the host fri.oden.utexas.edu
exit
logout
logs user out of current session logout
passwd used to change password
passwd this will prompt you for your old password then let you change it