1

Calculate the total disk space used by a list of files or directories

du -cshx ./a ./b

February 15, 2012openiduser14

Explanation

  • -s, --summarize; display only a total for each argument
  • -c, --total; produce a grand total
  • -x, --one-file-system; skip directories on different file systems
  • -h, --human-readable; print sizes in human readable format (e.g., 1K 234M 2G)

Related one-liners

0

Calculate the total disk space used by a list of files or directories

du -s file1 dir1 | awk '{sum += $1} END {print sum}'

December 28, 2011bashoneliners