« Back to File systems: Frequently Asked Questions

How to see the size of a directory

How to see the size of a directory on Linux?

Use the ds command to see the size of a directory or path on the system.

du -hs

With the du command the directory size can be retrieved. By using it with the options --human-readable and --summarize, a summarized total will be displayed.

Disk Usage

The du tool is very powerful to show disk usage of files and directories, but it needs the right options to get the right information. A good combination to start is using ‘-h’, so the output becomes human-readable and the output size is shown in kilobytes, megabytes, etc.

du -h

Now the output can be long, so summarizing is a good idea.

du -hs

You can also define a specific path

du -hs /etc

Learn more about du

This article uses the du command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: du

du cheat sheet

Other questions related to Linux file systems

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon