- df(disk free) 命令用于显示目前在 Linux 系统上的文件系统磁盘使用情况统计。
文件-h, --human-readable 使用人类可读的格式(预设值是不加这个选项的)。
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 4.4G 13G 26% /
devtmpfs 2.0G 0 2.0G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 2.0G 9.1M 2.0G 1% /run
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
/dev/sda1 1014M 161M 854M 16% /boot
tmpfs 394M 4.0K 394M 1% /run/user/42
tmpfs 394M 32K 394M 1% /run/user/0
- du(disk usage)命令用于显示目录或文件的大小。
-h或--human-readable 以K,M,G为单位,提高信息的可读性。
-X<文件>或--exclude-from=<文件> 在<文件>指定目录或文件。
显示test目录下面的子目录的目录大小和test目录的总的大小,最下面的1.3M为test目录的总大小。
# du -h test
608K test/test6
308K test/test4
4.0K test/scf/lib
4.0K test/scf/service/deploy/product
4.0K test/scf/service/deploy/info
12K test/scf/service/deploy
16K test/scf/service
4.0K test/scf/doc
4.0K test/scf/bin
32K test/scf
8.0K test/test3
1.3M test
- fdisk 是一个创建和维护分区表的程序,它兼容 DOS 类型的分区表、BSD 或者 SUN 类型的磁盘列表。
-l 列出素所有分区表。
# fdisk -l
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 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
Disk label type: dos
Disk identifier: 0x00092469
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdb: 8796.1 GB, 8796093022208 bytes, 17179869184 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
Disk label type: gpt
Disk identifier: E9DB1E69-E857-400F-8653-F45B587FCAB2
# Start End Size Type Name
1 2048 17179867136 8T unknown
Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 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
Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 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
- lsblk 列出所有可用块设备的信息,而且还能显示他们之间的依赖关系,但是它不会列出RAM盘的信息。
块设备有硬盘,闪存盘,cd-ROM等等。
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 8T 0 disk
└─sdb1 8:17 0 8T 0 part
sr0 11:0 1 1024M 0 rom