linux 磁盘空间使用查看

来源:互联网 发布:百度推广怎么优化账户 编辑:程序博客网 时间:2024/06/01 10:44


常用一:查看磁盘分区情况
QAS:~ # fdisk -l
Disk /dev/sda: 300 GiB, 322122547200 bytes, 629145600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000f2b9f

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1            2048  41945087  41943040   20G 82 Linux swap / Solaris
/dev/sda2  *     41945088 356513791 314568704  150G 83 Linux
/dev/sda3       356513792 629145599 272631808  130G 83 Linux


常用二:以磁盘分区为单位查看文件系统,使用df -h
QAS:/usr # df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2       148G   29G  118G  20% /
devtmpfs        3.8G     0  3.8G   0% /dev
tmpfs           3.8G   80K  3.8G   1% /dev/shm
tmpfs           3.8G  9.6M  3.8G   1% /run
tmpfs           3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sda3       128G   94M  127G   1% /home
还可以加其他参数比如 df -hT 查看分区格式等;


常用三:查看目录大小
命令: du -sh
QAS:~ # cd /usr
QAS:/usr # du -sh
28G .


常用四:查看目录下文件大小: ls -l
QAS:/usr # ls -l
total 9310188
drwxr-xr-x   3 root root       4096 Jul 16 04:30 X11R6
drwxr-xr-x   2 root root      69632 Oct 30 12:26 bin
-rw-r--r--   1 root root     192396 Oct 30 13:31 compat-libstdc++-33-3.2.3-69.el6.i686.rpm
drwxr-xr-x   2 root root       4096 Sep 21  2014 games
drwxr-xr-x   6 root root       4096 Jul 16 04:31 include
drwxr-xr-x   3 root root       4096 Oct 27 21:11 java
-rw-r--r--   1 root root   66443764 Oct 27 21:06 java.rpm
drwxr-xr-x  91 root root      24576 Oct 30 13:54 lib
drwxr-xr-x  95 root root      69632 Oct 31 12:52 lib64
-rw-r--r--   1 root root     202522 Oct 30 14:01 libstdc++33-3.3.3-11.9.x86_64.rpm
-rw-r--r--   1 root root     204127 Oct 30 12:14 libstdc++33-3.3.3-34.2.x86_64.rpm
drwxr-xr-x  11 root root       4096 Jul 16 04:30 local
drwxr-xr-x   2 root root      20480 Jul 16 04:33 sbin
drwxr-xr-x 175 root root       4096 Jul 16 04:33 share
drwxr-xr-x   3 root root       4096 Jul 16 04:30 src
lrwxrwxrwx   1 root root         10 Jul 16 04:30 tmp -> ../var/tmp
drwxr-xr-x   5 root root       4096 Jul 16 04:30 x86_64-suse-linux

原创粉丝点击