DEV Community

Cover image for Living in the Shell #18; du (Report Directory Size)
Babak K. Shandiz
Babak K. Shandiz

Posted on β€’ Originally published at babakks.github.io on

1 1

Living in the Shell #18; du (Report Directory Size)

du πŸ’½

Reports disk usage.

See summarized directory size -s

du -s ~/Downloads
Enter fullscreen mode Exit fullscreen mode
11732700        /home/babak/Downloads

Note that the result is in kilobytes.

Human-readable size values -h

du -sh ~/Downloads
Enter fullscreen mode Exit fullscreen mode
12G   /home/babak/Downloads

Exclude files by pattern --exclude

du -sh --exclude '*.iso' ~/Downloads
Enter fullscreen mode Exit fullscreen mode
7.1G   /home/babak/Downloads

See exhaustive sub-directory sizes

du ~/Documents
Enter fullscreen mode Exit fullscreen mode

Limit recursion depth -d

du -h -d 1 ~/Documents
Enter fullscreen mode Exit fullscreen mode

Include files in exhaustive size report -a

du -h -a ~/Documents
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay