1. Home
  2. Technical
  3. SSH / Shell
  4. How to view disk space usage and the number of files (inodes)?
  1. Home
  2. Technical
  3. How to view disk space usage and the number of files (inodes)?

How to view disk space usage and the number of files (inodes)?

Access to the console is required to view the file count.

establishing an SSH connection

What are inodes?

read more here

To view the amount of disk space used, run the following command in the SSH console:

quota -s
virt490:sn-69-1.tll07.zoneas.eu:~> quota
Disk quotas for user virt490 (uid 10490): 
   Filesystem blocks  quota    limit  grace files  quota  limit grace
   /dev/sdb1  41561M  512G     512G         169k   512k   512k

The displayed output will show the following information:

  • “Filesystem” is the filesystem in which the quota is implemented.
  • “Blocks” is used hard disk space in megabytes (example: 41561M = 41.5GB).
  • “Quota” and “limit” are applied hard disk capacity limits in gigabytes (512G).
  • “Grace” is not used.
  • “Files” number shows the total amount of files (inodes: 169k = 169,000)
  • “Quota” and “limit” show the inode limit (example: 512k = 512,000 limit)

To get the usage in megabytes, the corresponding number must be divided by 1024. If you divide by 1048576, you get the usage in gigabytes.

To see which directory takes up the most space, use:

du | sort -n | tail -50

To find out where in the directory there are the most files, use:

find | cut -d/ -f 2 | sort | uniq -c | sort -n | tail -50

If you also want to see the number of files in deeper directories, use:

find | cut -d/ -f 2-5 | sort | uniq -c | sort -n | tail -50

 

Updated on 19. Apr 2024

Was this article helpful?

Related Articles