Linux: Using the Terminal
The table below provides a searchable list of commands that are mentioned in the Intro to Unix tutorial. For a printable list of commands, download the ACCRE Cheat Sheet.
Command | Description |
---|---|
man | Displays the manual page for another command. For instance, "man ls" gives a manual on the ls command. You can even type "man man", which opens the manual for man itself. |
pwd | Prints out the present working directory. |
ls | Prints out the list of files in the current directory. |
cd | Changes the directory. |
mkdir | Makes a new, empty directory. |
rmdir | Removes a directory. The directory must be empty first |
rm -r | Removes a directory and any files that are contained within it. Be very careful using it! |
cat | Displays the entire contents of a file from start to finish. |
more | Displays the entire contents of a file page by page. |
less | Displays the entire contents of a file page by page, with additional features such as using the arrow keys to scroll up and down. Counterintuitively, the less command has greater functionality than the more command! The more command came first, and less was a play on the word "more". As we often like to say, "less is more , more or less." The author of less wrote an explanation here. |
cp | Copies files. |
mv | Moves files. |
rm | Removes files. |
cp -i, mv -i | Interactive mode: display a warning before copying or moving an existing file. |
rm -i | Interactive mode: display a warning before every removal. |
emacs | Edits text files; very popular with programmers. |
vim (or vi) | Edits text files; very powerful but has a steep learning curve. |
nano | Edits text files; easiest to learn. |
chmod | Changes read/write/execute permissions for a file. |
find | Finds files in a directory. |
alias | Automatically replaces one command with another: alias login=”ssh ken@login.accre.vanderbilt.edu” . Then typing in login (enter) will be the same as typing ssh ken@login.accre.vanderbilt.edu (enter). |
env | Lists system variables. |
export | Creates a system variable: export my_var=some_variable |
echo | Prints text to the screen. To print a system variable, type $ then its name: echo $my_var |
.bashrc | A special file in your home directory that lets you define aliases and system variables every time you start an ACCRE session. |
` (grave) | Any command within grave accents (not single quotes!) is executed first. echo “Today’s date and time is `date`” You can also use $(command) instead. |
< | Input redirection. |
> | Output redirection. |
2> | Error redirection. |
2>&1 | Error and output redirection to the same file. |
| (pipe) | Takes the output of the preceding command and makes it the input of the following command. |
wc | Word count. Usually used in piped commands, for instance: ls | wc |
grep | Gets a regular expression and prints each line that matches. Usually used in piped commands, for instance: ls | grep Hello |
sort | Sorts a file. Usually used in piped commands. |
uniq | Filters duplicate lines. Usually used in piped commands. |
cut | Cuts specific fields or columns. Usually used in piped commands. |
sed | Stream editor; does search and replace. Usually used in piped commands. |
accre_storage | Check your quota usage. |
/home | Home directories, one for every user. /home is stored in GPFS, so it is shared among all nodes in the cluster. It is backed up nightly by tape. |
/data | Additional data storage available for purchase. /data is also stored in GPFS and backed up nightly by tape. |
/scratch | Scratch space. Also stored in GPFS, and disk/file quotas are more permissive. However, it is never backed up. |
/tmp | Recommended for temporary storage while your job is running. 30+ GB of space per core. Not stored in GPFS, and not backed up. Please move results to /home, /scratch, or /data and clean up /tmp when your job is done. |