How to get the size of a directory using the command line in Linux

Written by Ian Carnaghan · 13 sec read >
  1. Open a new Terminal Window and type the following command:
    du -shc folderPath

    Explanation of the du command:

    du - estimate file space usage
    -s, --summarize, display only a total for each argument
    -h, --human-readable, print sizes in human readable format (e.g., 1K 234M 2G)
    -c, --total, produce a grand total


  2. Replace folderPath with the folder to check the size on.

Last Updated On April 07, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

Notify of