Table of Contents

Linux Commands Cheat Sheet

du : How to use du command in Linux with examples

man du

NAME
       du - estimate file space usage

SYNOPSIS
       du [OPTION]... [FILE]...
       du [OPTION]... --files0-from=F

DESCRIPTION
       Summarize disk usage of each FILE, recursively for directories.

       Mandatory arguments to long options are mandatory for short options too.

OPTIONS
       -s, --summarize
              display only a total for each argument

       -h, --human-readable
              print sizes in human readable format (e.g., 1K 234M 2G)


Example

# du -sh *
57M     bin
0       etc
0       games
36K     include
341M    lib
121M    lib64
12M     libexec
43M     local
42M     sbin
206M    share
0       src
0       tmp
#
# du -h --max-depth=1
57M     ./bin
42M     ./sbin
341M    ./lib
121M    ./lib64
206M    ./share
0       ./etc
0       ./games
36K     ./include
12M     ./libexec
43M     ./local
0       ./src
819M    .
#