码迷,mamicode.com
首页 > 系统相关 > 详细

Linux4.1磁盘du、df

时间:2017-11-01 23:00:43      阅读:310      评论:0      收藏:0      [点我收藏+]

标签:txt   参数   passwd   linu   目录大小   linux   bsp   块大小   blog   

df

  df查看已挂载磁盘的总容量、使用容量、剩余容量等。可以不添加任何参数,默认按k为单位显示。

[root@chy002 ~]# df                            #默认文件单位kb
文件系统          1K-块    已用     可用 已用% 挂载点
/dev/sda3      18658304 1058996 17599308    6% /
devtmpfs         499848       0   499848    0% /dev
tmpfs            505428       0   505428    0% /dev/shm
tmpfs            505428    6796   498632    2% /run
tmpfs            505428       0   505428    0% /sys/fs/cgroup
/dev/sda1        201388   76012   125376   38% /boot

  -h     根据磁盘的大小适当的显示单位

[root@chy002 ~]# df -h
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda3        18G  1.1G   17G    6% /
devtmpfs        489M     0  489M    0% /dev
tmpfs           494M     0  494M    0% /dev/shm
tmpfs           494M  6.7M  487M    2% /run
tmpfs           494M     0  494M    0% /sys/fs/cgroup
/dev/sda1       197M   75M  123M   38% /boot

  -i     查看inode使用情况

[root@chy002 ~]# df -i
文件系统          Inode 已用(I)  可用(I) 已用(I)% 挂载点
/dev/sda3      18668544   24029 18644515       1% /
devtmpfs         124962     364   124598       1% /dev
tmpfs            126357       1   126356       1% /dev/shm
tmpfs            126357     413   125944       1% /run
tmpfs            126357      13   126344       1% /sys/fs/cgroup
/dev/sda1        204800     330   204470       1% /boot 

du

  查看某个目录或者文件所占空间大小。

  不添加任何选项只列出目录,包含子目录大小。

[root@chy002 ~]# du /tmp/chy
4       /tmp/chy

  -a  全部文件与目录大小都列出来。

[root@chy002 ~]# du -a /tmp/chy
4       /tmp/chy/1.txt
0       /tmp/chy/p1.txt
4       /tmp/chy
[root@chy002 ~]# ls -l /tmp/chy
总用量 4
4 -rwxrwx--- 1 user chy002  4 10月 26 01:08 1.txt
0 lrwxrwxrwx 1 root root   15 10月 26 05:52 p1.txt -> /tmp/passwd.txt

  -h 系统自动调节文件单位   -b 以bytes单位   -k 以kb单位输出   -m  以MB单位输出

  -s 只列出总和,使用最多

[root@chy002 ~]# du -sh /tmp
44K     /tmp

  注意:du 查看的是文件所分配的块大小,并不是已经使用的大小。

[root@chy002 ~]# ls -ldh /boot
dr-xr-xr-x. 4 root root 4.0K 10月 17 06:44 /boot
[root@chy002 ~]# du -sh /boot
64M     /boot

  

 

Linux4.1磁盘du、df

标签:txt   参数   passwd   linu   目录大小   linux   bsp   块大小   blog   

原文地址:http://www.cnblogs.com/chyuanliu/p/7768809.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!