Checking Disk Usage in Unix
These two commands are used to check disk usage
Disk usage by user
Df –sh * sorts by folder and gives total size in mb/gb (linux) sorted by owner of the file
Checking disk usage
du -sh *
– by cding it to a specific directory, can check the files sizes in just that directory.
How To: Check OS X Disk Usage
In OS X there are two ways to do everything. Via the GUI, or Via the command line. Frequently the GUI method does fine for most uses. But sometimes a bit more information is needed.
In the GUI, getting Disc Usage is simple. Open Finder, click on the drive and look at the bottom of the finder window. The number of files selected and the space available is displayed. But, this only shows the current directory and includes ALL sub folders under it.
But with a little use of the command line we can get a lot more information. Opening terminal defaults to the active user’s home directory.
At this point type du -sh * We’re adding the s for “Display an entry for each specified file,” and h for “Human-readable” output.
This will give a readout like this:
As can be seen this then gives a readout of each directory in the current one and provides the total space it takes up. In cases of low hard drive space this gives a good way to quickly find folders that may be too big. It could also be run in the /Users folder on multi-user machines to find out who it using all the hard drive space.