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 list 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鈥檒l use to rename files. For example, ($ mv file newfile) would take the file named 鈥渇ile鈥 in the current directory and move it (rename it) to the file named 鈥渘ewfile鈥 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 鈥渇ilename鈥 file from your home to your scratch directory. -
rm
Remove Files. The rm command removes files. Be careful with this command! rm doesn鈥檛 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 鈥渇ilename鈥 in your current directory. -
mkdir
Make Directory. The mkdir command makes a new directory. ($ mkdir example) will make a directory with the name 鈥渆xample鈥 in the current directory. -
rmdir
Remove Directory. ($ rmdir directory) would delete the directory named 鈥渄irectory鈥 in the current directory. For the case where the directory isn鈥檛 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 鈥渆xample鈥 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.