UNIX COMMANDS CHEAT SHEET
Command Example Description
1. ls ls Lists files in current directory
ls -alF List in long format
2. cd cd tempdir Change directory to tempdir
cd .. Move back one directory
cd ~dhyatt/web-docs Move into dhyatt's web-docs directory
3. mkdir mkdir graphics Make a directory called graphics
4. cp cp file1 web-docs Copy file into directory
cp file1 [Link] Make backup of file1
5. rm rm [Link] Remove or delete file
6. mv mv [Link] [Link] Move or rename files
7. man man ls Online manual (help) about command
8. head head file1 Display the first 10 lines in a file
head -100 file1 Display the first 100 lines in a file
9. tail tail file1 Display the last 10 lines in a file
tail –f file1 Display the contents of the file as it
grows, last 10 lines at a time.
10. less more [Link] Look at file, one page at a time
11. more less [Link] Look at file, one page at a time
12. cat cat [Link] Print on the standard output
cat file1 file2 Concatenate files
13. grep <str><files> grep "bad word" file1 Look for occurrence of a certain pattern
in a file
14. chmod <opt> <file> chmod 644 *.html Change file permissions read only
chmod 755 [Link] Change file permissions to executable
15. ps <opt> ps aux List all running processes by #ID
ps aux | grep dhyatt List process #ID's running by dhyatt
16. kill <opt> <ID> kill -9 8453 Kill process with ID #8453
17. history history Lists commands you've done recently
18. top top Print system usage and top resource
hogs
19. pwd pwd Print name of current/working directory
20. gzip <file> gzip bigfile Compress file
gunzip [Link] Uncompress file
21. tar <file> tar -cf [Link] subdir Create an archive called [Link] of a
tar -xvf [Link] directory
Extract files from an archive file
22. ln –s <file> link ln –s file link Create symbolic link, link to file
23. df df –h Show disk space in human-readable
format
24. du du Show directory space usage
25. nohup <command> nohup cp file1 file2 Run a command immune to hang-ups,
26. <command> & nohup cp file1 file2 & Run a command in the background
27. ssh <user@host> ssh dhyatt@[Link] Connect to host as user
28. wget <url/file> wget [Link] Download file from valid url
29. scp scp dhyatt@[Link]:file1 Secure copy a file from one host to
dhyatt@[Link]:file2 another
Collected from [Link]