Check memory and hard drive usage on linux

Here are two very useful commands to see available memory and hard drive space on linux

To see available memory we will use free

  1.  
  2. # -h give us the output on a format readble for humans :)
  3. $ free -h
  4.  
  5.              total       used       free     shared    buffers     cached
  6. Mem:          7.8G       3.6G       4.2G         0B       356M       924M
  7. -/+ buffers/cache:       2.3G       5.4G
  8. Swap:          18G         0B        18G
  9.  
  10.  

Yo see hard drive usage we will use df

  1.  
  2.  
  3. # the same h stands for human readble
  4. $ df -h
  5.  
  6. Filesystem      Size  Used Avail Use% Mounted on
  7. /dev/sda3       193G   20G  163G  11% /
  8. udev            3.9G  4.0K  3.9G   1% /dev
  9. tmpfs           1.6G  1.1M  1.6G   1% /run
  10. none            5.0M     0  5.0M   0% /run/lock
  11. none            3.9G  1.5M  3.9G   1% /run/shm
  12. none            100M   12K  100M   1% /run/user
  13. cgroup          3.9G     0  3.9G   0% /sys/fs/cgroup
  14.  
  15.  

Leave a Reply

Your email address will not be published. Required fields are marked *