- 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