terminal.cab

All commands

du

Topic: Disks and space

Program: du

Shows how much space files and directories take.

Package: core-inodes

Usage

du [OPTION]... [FILE]...

Description

Show how much disk space each FILE takes, for directories with everything below them. Without FILE, the current directory. Sizes are KiB, rounded up.

Options in the simulator

17 more options of the real program, not in the simulator yet
  • -0, --null not in the simulator yet

    On a real system each line ends with a zero byte instead of a newline, for other programs.

  • -B, --block-size needs a value not in the simulator yet

    On a real system it sets the unit of the sizes freely.

  • -D, --dereference-args not in the simulator yet

    On a real system du then follows only symlinks given as FILE, not the ones below them.

  • --files0-from needs a value not in the simulator yet

    On a real system du reads the names from a file, separated by zero bytes.

  • -H not in the simulator yet

    On a real system du then follows only symlinks given as FILE, not the ones below them.

  • --inodes not in the simulator yet

    On a real system du then counts inodes instead of space.

  • -l, --count-links not in the simulator yet

    On a real system du counts a file with several hard links once for every name.

  • -P, --no-dereference not in the simulator yet

    On a real system du then follows no symlink, as it does without -L anyway.

  • -S, --separate-dirs not in the simulator yet

    On a real system a directory then counts only what lies directly in it, without subdirectories.

  • --si not in the simulator yet

    On a real system du works like -h, but with 1000 instead of 1024.

  • -t, --threshold needs a value not in the simulator yet

    On a real system du only shows entries above (or for a negative number below) a size.

  • --time value optional not in the simulator yet

    On a real system du then shows the latest change time below each line.

  • --time-style needs a value not in the simulator yet

    On a real system du then shows the latest change time below each line.

  • -X, --exclude-from needs a value not in the simulator yet

    On a real system du leaves out names that match a pattern.

  • --exclude needs a value not in the simulator yet

    On a real system du leaves out names that match a pattern.

  • -x, --one-file-system not in the simulator yet

    On a real system du stays on one file system and skips others mounted below.

  • --version not in the simulator yet

    On a real system it prints the version of the program.

Examples

From the lesson Delete, link, measure
du -sh *
8.0K	Documents
95M	archive
12K	logs
4.0K	notes.txt
44K	projects
df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        32G  4.3G   28G  14% /

Try it in the terminal

From the lesson Where has the space gone
du -h -d 1 /var 2>/dev/null
8.0K	/var/backups
4.0K	/var/cache
4.0K	/var/lib
4.0K	/var/local
31G	/var/log
4.0K	/var/mail
4.0K	/var/opt
12K	/var/spool
4.0K	/var/tmp
31G	/var

Try it in the terminal

Where you learn it

Lessons

All commands