How to check the size of a folder under the linux system du command

System environment CentOS release 7.2 For

example, to view the size of the home directory:

du -s /home

can also:

du -sh /home or

M display [root@localhost hadoop-1.0.4]# du -h --max-depth 1 or [root@localhost hadoop-1.0.4]# du -h --max-depth=1 92K ./conf 56K ./libexec 272K ./webapps 1.3M ./c++ 59M ./lib 944K ./ivy 19M ./logs 67M ./src 184K ./bin 55M ./docs 72K ./sbin 1.3M ./contrib 72K ./share 211M . is equivalent to [root@localhost hadoop-1.0.4]# du -h -d 1 [root@ localhost hadoop-1.0.4]# du -h -d 1 92K ./conf 56K ./libexec

























272K ​​./webapps
1.3M ./c++
59M ./lib
944K ./ivy
68K ./logs
67M ./src
184K ./bin
55M ./docs
72K ./sbin
1.3M ./contrib
72K ./share
192M .
[root @localhost hadoop-1.0.4]#Display

in kb
[root@localhost hadoop-1.0.4]# du -k --max-depth=1




system environment CentOS release 6.4 (Final), support the following command
[root@hadoop_slave1 servers ]# du -h --max-depth 1
210M ./hadoop-1.2.1
3.1M ./nginx
416M ./hbase-0.98.10.1-hadoop1
6.6M ./libevent-1.4.9-stable
233M ./jdk1. 6.0_25
302M ./lib
200M ./hbase-0.94.5-security
31M ./scala-2.11.7
257M ./hadoop-2.5.2
4.9M ./libevent-1.3
266M ./spark-1.6.0-bin-hadoop1
214M ./hadoop-1.0.4
42M ./zookeeper-3.4.6
371M ./hbase-1.0. 0
11M ./tomcat6.0.33
315M ./hadoop-2.6.0
1.5M ./memcached-1.2.0
3.1G .
[root@hadoop_slave1 servers]#



Note:



Check the file size of the current first-level directory

du -h --max- depth=1 to


view the size of all files in the current directory

du -sh
du -k --max-depth=1
to display several

commonly used 1. --max-

depth=<directory layers> Directories that exceed the specified number of layers After that, ignore it. If it is 0, it is equivalent to du-sh
du -sh --max-depth=0
du: warning: summarizing is the same as using --max-depth=0
1.2G .
But if directly du-0 (digital zero) means Each time the information of a directory is listed, no line breaks
2. -s or –summarize only display the total, the size of the current directory.
3.-h or –human-readable Use K, M, G as the unit to improve the readability of information.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326939143&siteId=291194637