‘-h’ option is used to print the files size in human readable form.
Example
hadoop fs -ls -h /user/cloudera/demo1
$hadoop fs -ls -h /user/cloudera/demo1
Found 6 items
-rw-r--r-- 1 cloudera cloudera 2 2022-03-22 23:58 /user/cloudera/demo1/a.txt
-rw-r--r-- 1 cloudera cloudera 4.5 M 2022-03-22 23:57 /user/cloudera/demo1/apacheNifi.docx
-rw-r--r-- 1 cloudera cloudera 5.9 M 2022-03-22 23:57 /user/cloudera/demo1/atlas.docx
-rw-r--r-- 1 cloudera cloudera 8.7 M 2022-03-22 23:57 /user/cloudera/demo1/atlasClient.docx
-rw-r--r-- 1 cloudera cloudera 6.7 M 2022-03-22 23:58 /user/cloudera/demo1/gradle.docx
-rw-r--r-- 1 cloudera cloudera 8.6 M 2022-03-22 23:58 /user/cloudera/demo1/maven.docx
You can add -S option to sort the files by their size in descending order.
$hadoop fs -ls -S -h /user/cloudera/demo1
Found 6 items
-rw-r--r-- 1 cloudera cloudera 8.7 M 2022-03-22 23:57 /user/cloudera/demo1/atlasClient.docx
-rw-r--r-- 1 cloudera cloudera 8.6 M 2022-03-22 23:58 /user/cloudera/demo1/maven.docx
-rw-r--r-- 1 cloudera cloudera 6.7 M 2022-03-22 23:58 /user/cloudera/demo1/gradle.docx
-rw-r--r-- 1 cloudera cloudera 5.9 M 2022-03-22 23:57 /user/cloudera/demo1/atlas.docx
-rw-r--r-- 1 cloudera cloudera 4.5 M 2022-03-22 23:57 /user/cloudera/demo1/apacheNifi.docx
-rw-r--r-- 1 cloudera cloudera 2 2022-03-22 23:58 /user/cloudera/demo1/a.txt
You can add -r option along with -S to sort the files by their size in ascending order.
$hadoop fs -ls -S -r -h /user/cloudera/demo1
Found 6 items
-rw-r--r-- 1 cloudera cloudera 2 2022-03-22 23:58 /user/cloudera/demo1/a.txt
-rw-r--r-- 1 cloudera cloudera 4.5 M 2022-03-22 23:57 /user/cloudera/demo1/apacheNifi.docx
-rw-r--r-- 1 cloudera cloudera 5.9 M 2022-03-22 23:57 /user/cloudera/demo1/atlas.docx
-rw-r--r-- 1 cloudera cloudera 6.7 M 2022-03-22 23:58 /user/cloudera/demo1/gradle.docx
-rw-r--r-- 1 cloudera cloudera 8.6 M 2022-03-22 23:58 /user/cloudera/demo1/maven.docx
-rw-r--r-- 1 cloudera cloudera 8.7 M 2022-03-22 23:57 /user/cloudera/demo1/atlasClient.docx
No comments:
Post a Comment