How to Determine How Many Inodes the Current Directory is Using

Some web hosting providers have a limit on how many inodes you can use. Here is the shell command to display how many inodes the current directory you are in is using:

find . -printf "%i\n" | sort -u | wc -l

If you don’t have shell access to your web server, you can do the same thing with a PHP web page. Just place this web page in the directory that you want to know the number of inodes it is using and access the PHP web page from your web browser. The PHP code to put in the web page file is:

<?php
  echo "<b>";
  system('pwd');
  echo "</b>: ";
  system('find . | wc -l');
  echo " inodes<br />\n<b>";
  system('cd ~/public_html; pwd');
  echo "</b>: ";
  system('cd ~/public_html; find . | wc -l');
  echo " inodes<br />\n<b>";
  system('cd ~; pwd');
  echo "</b>: ";
  system('cd ~; find . | wc -l');
  echo " inodes";
?>

Terminal

PHP Parse error: syntax error, unexpected $end

The following error may appear in your Apache error log file or displayed on a PHP web page:

Parse Error: syntax error, unexpected $end in ….. scripts.php on line …

If you are running PHP 5 then that means you probably need to enable the PHP configuration file option “short_open_tag”. In your php.ini file enable the option as follows:

short_open_tag = On