File Commands:
1. ls -– directory listing (to see the content of folder)
2. ls -al -– formatted listing with hidden files
3. cd dir -– change directory to dir
4. cd -– change to home
5. pwd -– show current directory
6. mkdir dir -– create a directory dir
7. rm file -– delete file
8. rm -r dir -– delete directory dir
9. rm -f dir -– force remove file
10. rm -rf dir -– force remove directory dir
11. cp file1 file2 -– copy file1 to file2
12. cp -r dir1 dir2 -– copy dir1 to dir2; create dir2 if it doesn't exist
13. mv file1 file2 –- rename or move file1 to file2
if file2 is an existing directory, moves file1 into directory file2
14. ln -s file link –- create symbolic link link to file
15. touch file –- create or update file
16. cat > file -– places standard input into file
17. more file –- output the contents of file
18. head file –- output the first 10 lines of file
19. tail file –- output the last 10 lines of file
20. tail -f file -– output the contents of file as it
SEARCHING :
1. grep pattern files -– search for pattern in files
2. grep -r pattern dir -– search recursively for pattern in dir
3. command | grep pattern -– search for pattern in the output of command
4. locate file –- find all instances of file
NETWORK :
1. ping host –- ping host and output results
2. whois domain -– get who is information for domain
3. dig domain –- get DNS information for domain
4. dig -x host -– reverse lookup host
5. wget file –- download file
6. wget -c file -– continue a stopped download
SHORTCUTS :
1. ctrl+c –- halt the current command
2. ctrl+z –- stops the current command ,resume with fg in the foreground or bg
in the background.
3. ctrl+d –- logout of current session, similar to exit
4. ctrl+w –- erases one word in the current line
5. ctrl+u –- erases the whole line
6. ctrl+r –- type to bring up a recent command
7. !! –- repeats the last command
8. exit –- log out of current session
PROCESS MANAGEMENT :
1. ps –- display your currently active processes
2. top -– display all running processes
3. killpid -– kill process id pid
4. killall proc -– kill all processes named proc (use with extreme caution)
5. bg –- lists stopped or background jobs; resume a stopped job in the background
6. fg –- brings the most recent job to foreground
7. fg n -– brings job n to the foreground
SYSTEM INFO :
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 -– who you are logged in as
6. finger user -– display information about user
7. uname -a –- show kernel information
8. cat /proc/cpuinfo –- cpu information
9. cat /proc/meminfo -– memory information
10. man command -– show the manual 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 location of app
15. which app –- show which app will bw run by default.
COMPRESSION :
1. tar cf file.tar files –- create a tar named file.tar containing files
2. tar xf file.tar –- extract the files from file.tar
3. tar czf file.tar.gz files -– create a tar with Gzip compression
4. tar xzf file.tar.gz –- extract a tar using Gzip
5. tar cjf file.tar.bz2 –- create a tar with Bzip2
6. gzip file –- compresses file and renames it to file.gz
7. gzip -d file.gz –- decompresses file.gz back to file.