Download UNIX COMMANDS CHEAT SHEET Command Example ... and more Study notes History in PDF only on Docsity! UNIX COMMANDS CHEAT SHEET Command Example Description 1. ls ls ls -alF Lists files in current directory List in long format 2. cd cd tempdir cd .. cd ~dhyatt/web-docs Change directory to tempdir Move back one directory Move into dhyatt's web-docs directory 3. mkdir mkdir graphics Make a directory called graphics 4. cp cp file1 web-docs cp file1 file1.bak Copy file into directory Make backup of file1 5. rm rm file1.bak Remove or delete file 6. mv mv old.html new.html Move or rename files 7. man man ls Online manual (help) about command 8. head head file1 head -100 file1 Display the first 10 lines in a file Display the first 100 lines in a file 9. tail tail file1 tail –f file1 Display the last 10 lines in a file Display the contents of the file as it grows, last 10 lines at a time. 10. less more index.html Look at file, one page at a time 11. more less index.html Look at file, one page at a time 12. cat cat index.html cat file1 file2 Print on the standard output 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 chmod 755 file.exe Change file permissions read only Change file permissions to executable 15. ps <opt> ps aux ps aux | grep dhyatt List all running processes by #ID 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 gunzip bigfile.gz Compress file Uncompress file 21. tar <file> tar -cf subdir.tar subdir tar -xvf subdir.tar Create an archive called subdir.tar of a 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@seq.edu Connect to host as user 28. wget <url/file> wget http://seq.edu/file Download file from valid url 29. scp scp dhyatt@seq.edu:file1 dhyatt@anotherserver.edu:file2 Secure copy a file from one host to another Collected from http://www.tjhsst.edu/~dhyatt/superap/unixcmd.html