With no options, du lists all directories below the current directory, along
with the space consumed by each directory. At the end, du calculates total disk space used within
that directory structure.
The du command is a good way to check how much space is being used by a particular user (du
/home/user1) or in a particular file system partition (du /var). By default, disk space is displayed
in 1K block sizes. To make the output friendlier (in kilobytes, megabytes, and gigabytes),
use the -h option as follows:
$ du -h /home/jake
114k /home/jake/httpd/stuff
234k /home/jake/httpd
137k /home/jake/uucp/data
701k /home/jake/uucp
1.0M /home/jake
The output shows the disk space used in each directory under the home directory of the user
named jake (/home/jake). Disk space consumed is shown in kilobytes (k) and megabytes (M).
The total space consumed by /home/jake is shown on the last line.
Finding Disk Consumption with find
The find command is a great way to find file consumption of your hard disk using a variety of criteria.
You can get a good idea of where disk space can be recovered by finding files that are over a
certain size or were created by a particular person.
176
Running the Show Part II
You must be the root user to run this command effectively, unless you are just checking
your personal files.
Pages:
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404