[[Email protected] ~]# llTotal 156drwxr-xr-x. Root root 4096 Jan 5 05:05Apps-rw-r--r--. 1 root root 156 Jul 21:47 common-FRIENDS.LOGDRWXR-xr-x. 2 root root 4096 Oct 9 09:18DATADRWXR-xr-x. 2 root root 4096 29 01:52Esdata-rw-r--r--. 1 root root 2231 Jul 24 22:00FLOW.DATDRWXR-xr-x. 9 root root 4096 Oct 8 08:13FLUMEDRWXR-xr-x. 2 root root 4096 Oct 30 18:30HADOOPTESTDRWXR-xr-x. 5 root root 4096 Oct 4 15:12HDPDATADRWXR-xr-x. 4 root root 4096 Oct 5 10:17HIVEDATADRWXR-xr-x. 3 root root 4096 Sep 25 13:59JOURNALDATADRWXR-xr-x. 5 root root 4096 Oct 13 13:55LOGSDRWXR-xr-x. 2 root root 4096 Oct 22 09:46out123-rwxr-xr-x. 1 root root 4482 19 09:57PWDDRWXR-xr-x. 3 root root 4096 Dec 21 07:02SOFTDRWXR-xr-x. Hadoop Hadoop 4096 June spark-1.6.2-bin-hadoop2.6drwxr-xr-x. 9 root root 4096 Oct 10 10:23SQOOPDRWXR-xr-x. 5 root root 4096 Nov 08:17 storm-Local-rw-r--r--. 1 root root 660 28 06:33Storm.yaml-rw-r--r--. 1 root root 124 Sep 28 10:06user_prefer.sh-rw-r--r--. 1 root root 7495 Nov 16 03:42Wordcount.jar-rw-r--r--. 1 root root, Oct 13 16:46WORD.TXTDRWXR-xr-x. 3 root root 4096 Jan 5 18:49Zkdata-rw-r--r--. 1 root root 54453 Jan 5 18:49Zookeeper.out[root@hadoop01 ~]# Du-sh. [Summary of all directories and files in the current directory,-S for summary,-H for humanized display in KB, MB, GB, TB format]6. 6G. [Root@hadoop01 ~]# Du-sh * [summarizes the size of each directory and file in the current directory]3. 2G Apps4.0K common-friends.log416k Data4. 0K Esdata4. 0K flow.dat82m Flume4. 0K hadooptest150m hdpdata92m hivedata66m journaldata344m logs16k out1238. 0K PWD2. 2G soft303m Spark-1.6.2-bin-hadoop2.627M sqoop52k Storm-Local4. 0K Storm.yaml4. 0K user_prefer.sh8. 0K Wordcount.jar4. 0K word.txt260m zkdata60k zookeeper.out[root@hadoop01 ~]# Du-sh Apps [summarize the size of the specified directory]3. 2G Apps[root@hadoop01 ~]# Du-sh logs/* [summarizes the size of all subdirectories and files below the specified directory]39M logs/Click_log8.0K logs/es-logs306m Logs/kafka-logs380k Logs/Test.log[root@hadoop01 ~]# Du-sh *|grep [M] [summarize all directories and files in the current directory, and use "grep [M]" to filter out all directories and files of size m (trillion)82M flume150m hdpdata92m hivedata66m journaldata344m logs303m Spark-1.6.2-bin-hadoop2.627M sqoop260m zkdata[root@hadoop01 ~]# Du-sh *|grep [G] [filter out directories and files of GB-size]3. 2G Apps2. 2G Soft[root@hadoop01 ~]# Du-sh *|grep [MG] [filter out directories and files of size MB and GB]3. 2G apps82m flume150m hdpdata92m hivedata66m journaldata344m logs2. 2G soft303m Spark-1.6.2-bin-hadoop2.627M sqoop260m zkdata[root@hadoop01 ~]# du-sh *|grep [MG]|SORT-NR [filter out directories and files of size MB and GB and sort in descending order]344M logs303m Spark-1.6.2-bin-hadoop2.6260M zkdata150m hdpdata92m hivedata82m flume66m journaldata27m sqoop3. 2G Apps2. 2G Soft[root@hadoop01 ~]#
Linux commands (2)-View directory and file size: Du-sh