Skip to Content
gnux

dux

Estimate file space usage.

Mirrors GNU du. Run it as dux, or as gnux dux.

Synopsis

dux [OPTION]... [FILE]...

GNU reference

Description

dux shows how much disk space each directory under each FILE (the current directory by default) takes, including everything below it, in 1024-byte blocks rounded up. -a lists files too, -s only the operands, and -d N only N levels down; -c adds a grand total. -h prints sizes like 1.5K, 23M and 4.0G (--si in powers of 1000), -k and -m use KiB and MiB, -b bytes, and -B SIZE any unit ('-BM' prints the unit too). --apparent-size counts the bytes files hold rather than the blocks allocated to them, which differs for sparse and compressed files. --inodes counts files instead of space. -S leaves subdirectories out of a directory's total, -x stays on one file system, -l counts a hard-linked file every time it is met (by default it is counted once), -L follows symbolic links and -H only those given as operands. -t SIZE hides entries smaller than SIZE (or, negative, larger). --exclude=PATTERN and -X FILE skip matching paths. --time adds the latest modification (or --time=atime, ctime) time in each subtree, formatted by --time-style. --files0-from=F reads NUL-separated operands from F, and -0 ends output lines with NUL. Where GNU du reads one directory at a time and prints entries in whatever order the file system returns them, dux reads directories in parallel, which is much faster on large trees and network drives, and then adds everything up in name order, so the output, and which path a hard-linked file is counted under, is the same every run. The block size defaults to DU_BLOCK_SIZE, BLOCK_SIZE or BLOCKSIZE when set. Names are quoted only when output goes to a terminal. On a terminal, dux shows gnux's view (--pretty=auto, the default; GNUX_PRETTY changes it): sizes aligned and colored by magnitude, a bar and a percentage giving each line's share of its operand, and the last part of each name highlighted, in the theme --theme or GNUX_THEME names (NO_COLOR keeps it uncolored). Piped or redirected output, and -0, stay exactly GNU's tab-separated lines; --pretty=always asks for the view anyway and --pretty=never turns it off.

Permissions

Needs read and search permission on every directory measured; an unreadable directory is reported and its own size still counted.

Use cases

  • Seeing which subdirectory takes most of a folder's space, from the bars and percentages.
  • Finding which directories fill a disk.
  • Checking how big a project, cache or build output has grown.
  • Comparing disk usage with apparent size to spot sparse files.
  • Counting files (inodes) where a file system runs out of inodes before space.
  • Monitoring a directory's size in a script or cron job.

Flags

  -a, --all                      write counts for all files, not just directories
  -A, --apparent-size            print apparent sizes rather than device usage
  -B, --block-size SIZE          scale sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes
  -b, --bytes                    equivalent to '--apparent-size --block-size=1'
  -l, --count-links              count sizes many times if hard linked
  -L, --dereference              dereference all symbolic links
  -D, --dereference-args         dereference only symlinks that are listed on the command line
      --exclude PATTERN          exclude files that match PATTERN
  -X, --exclude-from FILE        exclude files that match any pattern in FILE
      --files0-from F            summarize device usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input
      --help                     display this help and exit
  -h, --human-readable           print sizes in human readable format (e.g., 1K 234M 2G)
      --inodes                   list inode usage information instead of block usage
  -k, --kilobytes                like --block-size=1K
  -d, --max-depth N              print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument
  -m, --megabytes                like --block-size=1M
  -P, --no-dereference           don't follow any symbolic links (this is the default)
  -0, --null                     end each output line with NUL, not newline
  -x, --one-file-system          skip directories on different file systems
      --pretty WHEN[="always"]   the gnux terminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default
  -S, --separate-dirs            for directories do not include size of subdirectories
      --si                       like -h, but use powers of 1000 not 1024
  -s, --summarize                display only a total for each argument
      --theme NAME               color the view with the built-in theme NAME (gnux theme picks and saves one); GNUX_THEME sets the default
  -t, --threshold SIZE           exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative
      --time WORD[="mtime"]      show time of the last modification of any file in the directory, or any of its subdirectories; with WORD: atime, access, use, ctime or status
      --time-style STYLE         show times using STYLE, which can be: full-iso, long-iso, iso, or +FORMAT
  -c, --total                    produce a grand total
      --version                  output version information and exit

Examples

Your home folder grew by 20 GB: see each folder's share of it as a bar, one level deep

dux -h -d 1 ~

Your disk is nearly full: list the 10 biggest directories in your home, largest first

dux -h -d 1 ~ | sortx -h -r | headx -n 11
Output
48G	/home/alice
21G	/home/alice/Videos
12G	/home/alice/.cache
6.3G	/home/alice/projects

Show the total size of a project, in human-readable units

dux -sh ~/projects/website
Output
1.2G	/home/alice/projects/website

See how much node_modules folders take across all your projects

dux -sch ~/projects/*/node_modules
Output
412M	/home/alice/projects/api/node_modules
388M	/home/alice/projects/web/node_modules
800M	total

Measure a repository without its .git history

dux -sh --exclude=.git ~/projects/website

Find files over 100 MB to clean up

dux -a -t 100M -h ~/Downloads

Spot a sparse VM disk image: it takes far less space than its size

dux -h vm.qcow2 && dux -h --apparent-size vm.qcow2
Output
2.1G	vm.qcow2
40G	vm.qcow2

Find which directory holds millions of tiny files (out of inodes)

dux --inodes -d 1 /var | sortx -n -r | headx

Get a byte count for a script, without units

bytes=$(dux -sb dist | cutx -f1)
Output
5242880

Check only the root file system, not mounted drives under it

sudo dux -xh -d 1 /

See which log directories changed most recently

dux -sh --time /var/log/*
Output
1.3M	2026-10-12 09:41	/var/log/apt
96M	2026-10-12 10:02	/var/log/journal

Report sizes in megabytes with the unit shown

dux -BM -d 1 /srv
Output
120M	/srv/www
2048M	/srv/backups
2169M	/srv

Measure a list of paths produced by another program

find . -name '*.log' -print0 | dux -ch --files0-from=-

Show the biggest folders in the portable gnux shell, the same on every OS

gnux shell -c 'dux -h -d 1 . | sortx -h -r | headx -n 5'

Options

Each option has a page of its own, with its usage and examples.

  • -a, --all: Write counts for all files, not just directories.
  • -A, --apparent-size: Print apparent sizes rather than device usage.
  • -B, --block-size: Scale sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes.
  • -b, --bytes: Equivalent to '--apparent-size --block-size=1'.
  • -l, --count-links: Count sizes many times if hard linked.
  • -L, --dereference: Dereference all symbolic links.
  • -D, --dereference-args: Dereference only symlinks that are listed on the command line.
  • --exclude: Exclude files that match PATTERN.
  • -X, --exclude-from: Exclude files that match any pattern in FILE.
  • --files0-from: Summarize device usage of the NUL-terminated file names specified in file F; if F is -, then read names from standard input.
  • -h, --human-readable: Print sizes in human readable format (e.g., 1K 234M 2G).
  • --inodes: List inode usage information instead of block usage.
  • -k, --kilobytes: Like --block-size=1K.
  • -d, --max-depth: Print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument.
  • -m, --megabytes: Like --block-size=1M.
  • -P, --no-dereference: Don't follow any symbolic links (this is the default).
  • -0, --null: End each output line with NUL, not newline.
  • -x, --one-file-system: Skip directories on different file systems.
  • --pretty: The gnux terminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default.
  • -S, --separate-dirs: For directories do not include size of subdirectories.
  • --si: Like -h, but use powers of 1000 not 1024.
  • -s, --summarize: Display only a total for each argument.
  • --theme: Color the view with the built-in theme NAME (gnux theme picks and saves one); GNUX_THEME sets the default.
  • -t, --threshold: Exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative.
  • --time: Show time of the last modification of any file in the directory, or any of its subdirectories; with WORD: atime, access, use, ctime or status.
  • --time-style: Show times using STYLE, which can be: full-iso, long-iso, iso, or +FORMAT.
  • -c, --total: Produce a grand total.

Exit status

StatusMeaning
0success: every operand was processed
1failure: an operand could not be processed (diagnosed on standard error), or a command-line mistake

Help in the terminal

dux --help                # options, first examples, exit status
gnux help dux             # this page: the full manual
gnux help dux --OPTION    # one option in depth, with its examples

See also

On this page