Useful commands on Ubuntu (debian)

Bare with me as I periodically update this list with useful commands for linux (ubuntu/debian).

  1. Check the number of processors: nproc
  2. Check free RAM : free -h To continuously monitor watch free -h
  3. Checking ubuntu version on the system: lsb_release -a
  4. Checking the processes running as a tree diagram: pstree
  5. Check resource utilization (like task manager in windows): top
  6. Checking sytem file size: df -ah
  7. Checking file size in directory: du -sh *
  8. Disk partition and disk usage: lsblk
  9. Printing output of a command into a log file: nohup . For eg: nohup lsblk will output the result of lsblk into a log file in the current folder.
  10. Opening the current folder (GUI) from terminal: ​​nautilus .
  11. Checking linux (kernel) verison: uname -a
  12. Show cpu and motherboard details: lshw -class cpu
  13. To check who are all logged into the system: who  or w
  14. pushd and popd to navigate to and back to the directory eg: pushd ~/Desktop
  15. file to print the type of file eg: file foo prints out file format as foo:JPEG image data
  16. search for a file: locate  prints file location
  17. to constantly update a command every few seconds: watch
  18. tail and head for printing the end and beginning of a file.
  19. functions which give information about a command: man  (manual page), whatis  (one line description), info (only available for some commands)
  20. You can redirect standard output and standard error to different files: nohup myprogram > myprogram.out 2> myprogram.err
  21. To run a program in the background eg: firefox &
  22. To capture what is being printed during boot: journalctl
  23. Checking internet connection eg: ​​ping 8.8.8.8 or ​mtr 8.8.8.8
  24. Changing directory/file permissions: sudo chmod 700
  25. Changing ownership: sudo chown
  26. Changing group: sudo chgrp
  27. Listing the directory structure with depth=2 levels : tree -d -L 2
  28. printenv will print out any environment variables you have set.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s