HostOnNet Blog

How many inodes you have in a directory?

Looking for Linux Server Admin or WordPress Expert? We can help.

How to find out how many inodes you are using on a hard disk or in a directory?

To find the inode limit for your whole disk or VPS

df -i

To find and display how many inodes are in a certain directory and list all the subdirectories , go to the directory and run:

echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"

Output will be similar to below

[/tmp]# echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"
Detailed Inode usage for: /tmp
273		- eaccelerator
1		- .ICE-unix
1		- lost+found
3		- pear
1		- pyzor
1		- .pyzor
1		- update-cache-11970678
1		- update-cache-584a17d2
49		- update-extraction-11970678
1		- update-extraction-584a17d2
Total: 		16034

About Annie

I've been working in Technical Section for over 10 years in a wide range of tech jobs from Tech Support to Software Testing. I started writing blog for my future reference and useful for all.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.