Shell Script to find disk usage in a directory

I need to find disk usage for a specific directory. I do not need a list of files.

I used

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

Is there any other way to get a list of directories using a disk? (% disk usage will be large)

+3
source share
2 answers

use du -s

Example:

~ $ du -sh /home/shaman/tmp/
12M /home/shaman/tmp/
+2
source

Use du -sh

From the 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)
+4
source

Source: https://habr.com/ru/post/1781624/


All Articles