Perl script to check on Disk Usage

categories: Code | Perl

I wrote this script a while back to get a snapshot of my disk usage. Since I'm using a powerbook and hard drive space is limited, I thought it wise to make sure I didn't have too much garbage lying around my drive.

To use this script, simply download the disk_usage.pl file and place in a good location on your hard drive. Once you have downloaded the file, open up the Terminal application. Run the command:

chmod 755 /path/to/file/disk_usage.pl

Once you have set the execute permission, you can now run it.

perl /path/to/file/disk_usage.pl /your/dir/here/

where /path/to/file = the location where you downloaded the file and /your/dir/here the directory you want to scan.

The script simply does a scan of your drive using the unix 'du -ks' command and formats it cleanly in megabytes.


A screenshot of the script in action

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Nice script

Have you thought about giving it an HTML front end, so that you can run it through a browser?

Back to top