QuickStart - Linux

The following commands will help you with the basics of managing files and navigating around directories of the Linux system used for the HPC cluster. 

ls – List Files The ls command will lists the files in a directory. By default, ($ ls) lists the files in your current directory.  You can also list files recursively; that is, list all  files in directories inside the current directory with ($ ls ­-R).  ls can also list files in another directory if you specify the directory. For example,($ ls scratch) from your home directory will list all your files in your scratch directory.

cd – Change Directory The cd command changes to another directory. For example, cd /home/yourNETID/scratch will take you to your scratch directory.  By default, ($ cd) changes to your user home directory.  Using ($ cd ..) will move you upwards into the parent directory of your current directory.

mv – Move Files The mv command  moves  a  file  to  a  new  location.  This  is  also  the  command  you’ll  use  to  rename  files.  For example, ($ mv  file  newfile)  would  take  the  file  named  “file”  in  the  current  directory  and  move  it (rename it)  to  the  file named “newfile” into your current directory

cp – Copy Files The cp command works the same way as the mv command, except it copies the original files instead of moving them.    You  can  also  do  a  recursive  copy  with  ($ cp  ­-r).  This  copies  a  directory  and  all  files  inside  it  to  a  new location.  For  example,  ($ cp  filename  scratch/)  places  a  copy  of  the  “filename”  file  from  your  home  to  your scratch directory.

rm – Remove Files  The rm command  removes  files. Be  careful with  this  command!  rm doesn’t  ask  you  for  confirmation by default, but you can use ($ rm filename) for a more interactive experience.  For example, ($ rm -i filename) would ask for prompt you first before it deletes the file with “filename” in your current directory.

mkdir – Make Directory. The mkdir command makes a new directory. ($ mkdir example) will make a directory with the name “example” in the current directory.

rmdir - Remove Directory. ($ rmdir directory) would  delete  the  directory  named “directory”  in  the  current  directory.    For  the  case  where  the  directory  isn’t  empty,    ($ rm  ­-r) directory  would delete the directory and all the files in it.  Be careful with this command.

touch – Create Empty Files The  touch  command  creates  an  empty  file.
For  example,  ($ touch  example)  creates  an  empty  file  named “example” in the current directory.

pwd ­ - Present Working Directory ($ pwd) will display the full path of your current directory

[tab] ­ Tab Completion is capable of helping you type path names. If you type a partial command and hit the [Tab] key, it will try and autocomplete what you were trying to type. If it can't guess what you are trying to type, it will beep at you. If you hit [Tab] again, it will give you a list of matches to select from. Here's an example of using tab completion.

©