ADVERTISEMENT

Linux Commands ❯ du

du

Summarize disk usage of each FILE, recursively for directories.
syntax:

du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F
  • du
    display the disk usage summary of all the directories and each of its sub directories
  • du my_dir1
    display the disk usage summary of all the directories under my_dir1 and each of its sub directories
  • du -a my_dir1
    display the disk usage summary of all the files and directories under my_dir1 and each of its sub directories
  • du -d 1 -h
    display the disk usage summary of all the directories in current directory
  • du -h my_dir1
    display the disk usage summary of all the directories under my_dir1 and each of its sub directories in a human readable format. the sizes are printed in KB,MB or GB respectively.
  • du -h * | sort -h
    display the disk usage summary of all the directories and subdirectories in current directory sorted by the size
  • du -k my_dir1
    display the summary of disk usage of directory tree along with its subtrees in Kilobytes
  • du -m my_dir1
    display the summary of disk usage of directory tree along with its subtrees in Megabytes
  • du -s -h
    display the total usage of current directory in human readable format
  • du -s -h my_dir1
    display the total usage of my_dir1 directory in human readable format
  • du -s -h *
    display the disk usage summary of all the files and directories of current directory not its sub directories.
  • du -s -h */
    display the disk usage summary of all the directories( not files ) in current directory
  • du -t 2M -mh my_dir1
    display all the files and subdirectories under my_dir1 whose disk usage is more than 2MB