How to check the size of a file in HDFS?

In Hadoop Distributed File System (HDFS), you can use the command hdfs dfs -du to check the size of files.

hdfs dfs -du <文件路径>

The is the path of the file you want to view, which can be an absolute or relative path in HDFS.

For example, to check the size of the file /user/hadoop/example.txt under the HDFS root directory, you can run the following command:

hdfs dfs -du /user/hadoop/example.txt

The output of the command will provide you with the size of the file in bytes.

bannerAds