Balualways
Balualways

Reputation: 4520

Shell Script to find disk usage of the directory

I need to find the disk usage of a specific directory. I don't want the listing for files.

I have used

find /home/a491504/ -type d -exec du -akS {} \;

Is there any other way to fetch the directory list with disk usage? (% disk usage would be great)

Upvotes: 3

Views: 5289

Answers (2)

codaddict
codaddict

Reputation: 455390

Use du -sh

From man page:

-s, --summarize       display only a total for each argument
-h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)

Upvotes: 4

Illarion Kovalchuk
Illarion Kovalchuk

Reputation: 5894

use du -s

example:

~ $ du -sh /home/shaman/tmp/
12M /home/shaman/tmp/

Upvotes: 2

Related Questions