cPanel Scripting

How to check inode usage of an account on a cPanel server

check Inode usage
check Inode usage

What is Inode?

An inode is an internal data structure that Linux uses to store information about a filesystem object. Each file/directory on a Linux system has an inode and is identified by an inode number, hence the inode count is the total number of files/directories on the server. Inodes provide important information of a file such as user, group ownership, access mode and type.

How to check Inode usage of an account on a cPanel server?

You can enable the option “Display File Usage information in the cPanel stats bar (inode count)” in “Tweak Settings” to display the inode count on the cPanel status bar.

WHM »Server Configuration »Tweak Settings »Display File Usage information in the cPanel stats bar (inode count)

Then, the inode count (File Usage) will show in the cPanel account of a user. Please check the below image for reference.

check Inode usage

Also, you can find the total Inode usage of the current directory by using the following command.

 
find . | wc -l

The following script can help you to check Inode usage for all directories located in the current directory:

 
echo "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"

The output will be like this:

 
Inode usage for: /home/fortest
2 - .cpanel
1 - etc
1 - .htpasswds
16 - mail
2 - public_ftp
2 - public_html
1 - tmp
Total: 32

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Button

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

Add Comment

Click here to post a comment

Topics