Resource Pages
Start Here
Set up UTCS access, Python, Git, coverage, and required tools.
Git Guidance
Configure Git and practice common repository workflows.
Unix/Linux Commands
Searchable command reference for working in the Linux shell.
Command Categories
Jump to a category below.
File Commands
| # | Command | Use |
|---|---|---|
| 1 | ls |
Directory listing |
| 2 | ls -al |
Formatted listing with hidden files |
| 3 | ls -lt |
Sort a formatted listing by time modified |
| 4 | cd dir |
Change directory to dir |
| 5 | cd |
Change to home directory |
| 6 | pwd |
Show current working directory |
| 7 | mkdir dir |
Create a directory named dir |
| 8 | cat > file |
Place standard input into file |
| 9 | more file |
Output the contents of file |
| 10 | head file |
Output the first 10 lines of file |
| 11 | tail file |
Output the last 10 lines of file |
| 12 | tail -f file |
Output the contents of file as it grows, starting with the last 10 lines |
| 13 | touch file |
Create or update file |
| 14 | rm file |
Delete file |
| 15 | rm -r dir |
Delete directory |
| 16 | rm -f file |
Force remove file |
| 17 | rm -rf dir |
Force remove directory dir |
| 18 | cp file1 file2 |
Copy the contents of file1 to file2 |
| 19 | cp -r dir1 dir2 |
Copy dir1 to dir2; create dir2 if it is not present |
| 20 | mv file1 file2 |
Rename or move file1 to file2; if file2 is an existing directory, move file1 into it |
| 21 | ln -s file link |
Create symbolic link link to file |
Process Management
| # | Command | Use |
|---|---|---|
| 1 | ps |
Display the currently running processes |
| 2 | top |
Display all running processes |
| 3 | kill pid |
Kill the process with the given process ID |
| 4 | killall proc |
Kill all processes named proc |
| 5 | pkill pattern |
Kill all processes matching pattern |
| 6 | bg |
List stopped/background jobs; resume a stopped job in the background |
| 7 | fg |
Bring the most recent job to the foreground |
| 8 | fg n |
Bring job n to the foreground |
File Permissions
| # | Command | Use |
|---|---|---|
| 1 | chmod octal file |
Change the permission of file to octal. Use 4 for read (r), 2 for write (w), and 1 for execute (x), adding values separately for user, group, and world. |
Searching
| # | Command | Use |
|---|---|---|
| 1 | grep pattern file |
Search for pattern in file |
| 2 | grep -r pattern dir |
Search recursively for pattern in dir |
| 3 | command | grep pattern |
Search for pattern in the output of a command |
| 4 | locate file |
Find all instances of file |
| 5 | find . -name filename |
Search in the current directory and below for files/directories with names starting with filename |
| 6 | pgrep pattern |
Search for named processes matching pattern and return their process IDs |
System Info
| # | Command | Use |
|---|---|---|
| 1 | date |
Show the current date and time |
| 2 | cal |
Show this month’s calendar |
| 3 | uptime |
Show current uptime |
| 4 | w |
Display who is online |
| 5 | whoami |
Show who you are logged in as |
| 6 | finger user |
Display information about user |
| 7 | uname -a |
Show kernel information |
| 8 | cat /proc/cpuinfo |
Show CPU information |
| 9 | cat /proc/meminfo |
Show memory information |
| 10 | man command |
Show the manual page for command |
| 11 | df |
Show disk usage |
| 12 | du |
Show directory space usage |
| 13 | free |
Show memory and swap usage |
| 14 | whereis app |
Show possible locations of app |
| 15 | which app |
Show which application will run by default |
Compression
| # | Command | Use |
|---|---|---|
| 1 | tar cf file.tar file |
Create a tar archive named file.tar containing file |
| 2 | tar xf file.tar |
Extract files from file.tar |
| 3 | tar czf file.tar.gz files |
Create a gzip-compressed tar archive |
| 4 | tar xzf file.tar.gz |
Extract a gzip-compressed tar archive |
| 5 | tar cjf file.tar.bz2 |
Create a bzip2-compressed tar archive |
| 6 | tar xjf file.tar.bz2 |
Extract a bzip2-compressed tar archive |
| 7 | gzip file |
Compress file and rename it to file.gz |
| 8 | gzip -d file.gz |
Decompress file.gz back to file |
Network
| # | Command | Use |
|---|---|---|
| 1 | ping host |
Ping host and output results |
| 2 | whois domain |
Get whois information for a domain |
| 3 | dig domain |
Get DNS information for a domain |
| 4 | dig -x host |
Reverse lookup host |
| 5 | wget file |
Download file |
| 6 | wget -c file |
Continue a stopped download |
Shortcuts
| # | Command | Use |
|---|---|---|
| 1 | Ctrl+C |
Halt the current command |
| 2 | Ctrl+Z |
Stop the current command; resume with fg in the foreground or bg in the background |
| 3 | Ctrl+D |
Log out of the current session, similar to exit |
| 4 | Ctrl+W |
Erase one word in the current line |
| 5 | Ctrl+U |
Erase the whole line |
| 6 | Ctrl+R |
Search recent command history |
| 7 | !! |
Repeat the last command |
| 8 | exit |
Log out of the current session |