du

summarize file space usage 

Command


SYNOPSIS

du [-a|-s] [-hkrtx] [-l num] [pathname ...]


DESCRIPTION

du reports the amount of file space used by the files indicated by the given pathnames. If pathname is a directory, du reports the total amount of file space used by all files in that directory and in each subdirectory in its hierarchy. If you do not specify any pathname, du assumes the current directory. Files with multiple links are only counted once.

du measures file space in 512-byte units. The attempt is made to report actual file space used, if possible. This means on UNIX systems actual file space used for sparse files; on 7/2008R2/8/2012/10/2016 systems actual file space used for compressed files.

Options

-a 

generates a report for all files in pathname.

-h 

displays file sizes using more human-friendly units. Units used are:

B	Bytes
KB	Kilobytes
MB	Megabytes
TB	Terabytes
PB	Petabytes
EB	Exabytes

When this option is specified, each file size is displayed using the most appropriate unit and is rounded to two decimal places.

-k 

displays file sizes in 1024-byte (1K) units.

-l num 

displays only num levels of subdirectories.

-r 

reports files which cannot be opened and directories which cannot be read; this is the default behavior.

-s 

does not display file size totals for subdirectories.

-t 

displays the total amount of space used by all pathnames examined.

-x 

displays file sizes for only those files contained on the same device as pathname.


ENVIRONMENT VARIABLES

TK_NTLINKS_OFF 

MKS Toolkit supports hard links under 7/2008R2/8/2012/10/2016 on NTFS file systems. There is a slight loss of performance for this support. If you do not require hard link support, you should set and export the environment variable TK_NTLINKS_OFF to disable this support.

TK_UNIX_FILESYSTEM 

When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use.

Because the virtual file system treats all mounted drives as part of the same file system, the command:

du /

traverses and displays information about all mounted drives when the Enhanced UNIX Compatibility Mode is on. To exclude mounted drives, use the command:

du -x /

For details on the Enhanced UNIX Compatibility Mode and the virtual file system, see the EUCM reference page.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure due to any of the following:

— invalid command line option
— cannot access a directory
— cannot read a directory
— cannot access file information


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.

The -h, -l, and -t options are extensions to the POSIX and XPG standards.


NOTE

du computes file space in units of 512 bytes. The actual disk space used by files and directories may be more, since some systems allocate space in units of some multiple of a sector. On UNIX System V, it is usually two sectors; on UNIX Version 7, it is one sector.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
df, find, ls


PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.