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 ...]
-s |
Shows the result in the aggregate summary of file lengths rather than the individual files. |
-h |
Formats files size in the human-readable format (e.g |
-v |
Displays the names of columns as the header line |
-x |
Excludes snapshots from the result calculation. |
Example:
$ hadoop fs -du /user/hadoop/dir1 /user/hadoop/file1 hdfs://nn.example.com/user/hadoop/dir1