Linux Commands | File Management | du Check Disk Usage by Directory/File

du Command

The du command checks current disk usage by specific directory or file.

Syntax

du (options) [file name or folder name]

Options

  • -s, --summarize: Combines subdirectories and prints only the total size.
  • -a: --all. Prints all files and all subdirectories.
  • -c: --total. Prints the total on the last line.
  • -k: Displays output numbers in 1 Kbyte units.
  • -x: --one-file-system. Prints only file usage for the current file system.

du Command Examples

Example

du -ks /Users/devkuma/Sites/
119852 /Users/devkuma/Sites/

Tip

Run the following commands to easily view the contents of the current directory.

du -ks *
du -ks -h *

References