du

Displays the size of files and directories contained in the given directory or the length of a file in case it’s just a file.

The du returns three columns with the following format:

size disk_space_consumed_with_all_replicas full_path_name

Returns 0 on success and -1 on error

The usage is as follows:

$ hadoop fs -du [-s] [-h] [-v] [-x] URI [URI ...]
Arguments

-s

Shows the result in the aggregate summary of file lengths rather than the individual files.
Without the -s option, the calculation is done by going 1 level deep from the given path

-h

Formats files size in the human-readable format (e.g 64.0m instead of 67108864)

-v

Displays the names of columns as the header line

-x

Excludes snapshots from the result calculation.
Without the -x option (default), the result is always calculated from all INodes, including all snapshots under the given path

Example:

$ hadoop fs -du /user/hadoop/dir1 /user/hadoop/file1 hdfs://nn.example.com/user/hadoop/dir1
Found a mistake? Seleсt text and press Ctrl+Enter to report it