linux系统下怎么查看文件夹的大小 du命令
linux系统下如何查看文件夹的大小 du命令
系统环境CentOS release 7.2
比如查看home目录的大小:
du -s /home
也可以:
du -sh /home
或
以M显示
[root@localhost hadoop-1.0.4]# du -h --max-depth 1
或
[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 .
和 [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]#
以kb显示
[root@localhost hadoop-1.0.4]# du -k --max-depth=1
系统环境CentOS release 6.4 (Final),支持一下命令
[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]#
注:
查看当前一级目录文件大小
du -h --max-depth=1
查看当前目录所有文件大小
du -sh
du -k --max-depth=1
以kb为单位显示
常用的几个参数
1.–max-depth=<目录层数> 超过指定层数的目录后,予以忽略。如果为0 则相当于du-sh
du -sh --max-depth=0
du: warning: summarizing is the same as using --max-depth=0
1.2G .
但是如果直接du-0(数字零)表示每列出一个目录的信息,不换行
2.-s或–summarize 仅显示总计,即当前目录的大小。
3.-h或–human-readable 以K,M,G为单位,提高信息的可读性。
系统环境CentOS release 7.2
比如查看home目录的大小:
du -s /home
也可以:
du -sh /home
或
以M显示
[root@localhost hadoop-1.0.4]# du -h --max-depth 1
或
[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 .
和 [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]#
以kb显示
[root@localhost hadoop-1.0.4]# du -k --max-depth=1
系统环境CentOS release 6.4 (Final),支持一下命令
[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]#
注:
查看当前一级目录文件大小
du -h --max-depth=1
查看当前目录所有文件大小
du -sh
du -k --max-depth=1
以kb为单位显示
常用的几个参数
1.–max-depth=<目录层数> 超过指定层数的目录后,予以忽略。如果为0 则相当于du-sh
du -sh --max-depth=0
du: warning: summarizing is the same as using --max-depth=0
1.2G .
但是如果直接du-0(数字零)表示每列出一个目录的信息,不换行
2.-s或–summarize 仅显示总计,即当前目录的大小。
3.-h或–human-readable 以K,M,G为单位,提高信息的可读性。