du
du - estimate file space usage
Syntax
du [options] [file]
Options
-a
: Display an entry for each file in a file hierarchy.-b
: Display the size in bytes.-c
: Display a total for the directory.-d
: Specify the depth of the directory.-h
: Display the size in a human-readable format.-k
: Display the size in kilobytes.-m
: Display the size in megabytes.-s
: Display only a total for each argument.-x
: Skip directories on different file systems.-L
: Dereference symbolic links.-S
: Display only the total size of each argument.-t
: Sort by modification time.-r
: Reverse the order of the sort.--help
: Display help information.--version
: Display version information.--time
: Show time of the last modification of any file in the directory, or any of its subdirectories.--time=WORD
: Show time as WORD instead of modification time.--time-style=STYLE
: Show time using STYLE.--block-size=SIZE
: Use SIZE-byte blocks.--exclude=PATTERN
: Exclude files that match PATTERN.--max-depth=N
: Print the total for a directory only if it is N or fewer levels below the command line argument.--one-file-system
: Skip directories on different file systems.--threshold=SIZE
: Print only directories with sizes greater than or equal to SIZE.--total
: Produce a grand total.--si
: Like -h, but use powers of 1000, not 1024.
Examples
Display the size of a file
du file
Display the size of a directory
du directory
Display the size of a directory in human-readable format
du -h directory
Display the size of a directory with a specific depth
du -d 1 directory
du -h --max-depth=1 /var/
Display the size of a directory with a total
du -c directory
Display the size of a directory with a total in human-readable format
du -ch directory
Display the size of a directory with a total in kilobytes
du -k directory
Display the size of a directory with a total in megabytes
du -m directory
Display the size of a directory with a total in bytes
du -b directory
Display the size of a directory with a total for each argument
du -s directory
Display the size of a directory with a total for each argument in human-readable format
du -sh directory
Display the size of a directory with a total for each argument in kilobytes
du -sk directory
Display the size of a directory with a total for each argument in megabytes
du -sm directory
Display the size of a directory with a total for each argument in bytes
du -sb directory
Display the size of a directory with a total for each argument in human-readable format and sort by modification time
du -sh -t directory
Display the size of a directory with a total for each argument in human-readable format and sort by modification time in reverse order
du -sh -t -r directory
Display the size of a directory with a total for each argument in human-readable format and sort by modification time in reverse order and skip directories on different file systems
du -sh -t -r -x directory
Display the size of a directory with a total for each argument in human-readable format and sort by modification time in reverse order and skip directories on different file systems and dereference symbolic links
du -sh -t -r -x -L directory
Display the size of a directory with a total for each argument in human-readable format and sort by modification time in reverse order and skip directories on different file systems and dereference symbolic links and display only the total size of each argument
du -sh -t -r -x -L -S directory
Display the size of a directory with a total for each argument in human-readable format and sort by modification time in reverse order and skip directories on different file systems and dereference symbolic links and display only the total size of each argument in bytes
du -sh -t -r -x -L -S -b directory
Display the 10 biggest files in a directory
du -ah /var | sort -n -r | head -n 10
Display the 10 biggest files in a directory in human-readable format
du -xah /var | sort -h -r | head -n 10