May 2017
Beginner
552 pages
28h 47m
English
The -c option will calculate the total size used by files or directories, as well as display individual file sizes:
$ du -c FILENAME1 FILENAME2..
du -c process_log.sh pcpu.sh
4 process_log.sh
4 pcpu.sh
8 total
Alternatively, use it like one of these:
$ du -c DIRECTORY
$ du -c test/
16 test/
16 total
Or:
$ du -c *.txt
# Wildcards
The -c option can be used with options such as -a and -h to produce the usual output, with an extra line containing the total size.
The -s option (summarize), will print the grand total as the output. The -h flag can be used with it to print in a human-readable format:
$ du -sh /usr/bin
256M /usr/bin