Display Human Readable File Storage

Here is a quick code snippet that will allow you to read the memory usage of files.

You can use the command du this will go through the current folder and output the memory of each file. But it doesn't give a human readable view of the files.

To give you a human readable view of this data you can add the flag -h

du -h

This will display the file and folder size of everything in the current folder. But it returns everything in a random order you can change this by adding a sort filter.

du -h | sort

But this sort isn't a natural sort as it will order things like this 1M, 10M, 2M.

To change this to a natural sort you can add a flag of -h to the sort filter.

du -h | sort -h

This will order things in a more human natural way of 1M, 2M, 10M.

If you want to reverse this order you can add a -r flag in the command.

du -h | sort -h -r


Reliable uptime monitoring and instant alerts for any website downtime.

  • Uptime Monitoring
  • Performance Monitoring
  • SSL Certificate Alerts
  • Domain Monitoring
  • DNS Checker
  • XML Sitemap Monitoring