To find the size of a directory in HDFS with Hadoop, try these commands:
Basic Disk Usage with -du:
hadoop fs -du /path/to/directory
This lists the size of each file and folder inside the specified directory.
Get a Total Size Summary with -du -s:
hadoop fs -du -s /path/to/directory
Adding -s gives you the combined size of everything in the directory, instead of individual files.
Check Available Space with -df -h:
hadoop fs -df -h /path/to/directory
This displays the used and available storage in a readable format.
These commands are handy for checking how much HDFS storage you’re using