(1)、该命令会列出当前系统所有挂载的文件系统以及它们的使用情况,包括总容量、已用空间、可用空间、使用百分比等信息
df -h
如果查看某一个文件夹的,可以 df -h folderName
(2)、计算指定目录下所有文件和子目录所占用的磁盘空间大小,并以人类可读的格式显示出来。
如果省略路径参数,则默认为当前目录
du -sh /path/to/directory
root@user-2288H-V5:/# du -sh tmp
5.0G tmp
(3)、查看系统硬件配置和磁盘分区情况
lsblk
root@user-2288H-V5:/# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 65.1M 1 loop /snap/gtk-common-themes/1515
loop1 7:1 0 40.4M 1 loop /snap/snapd/20671
loop2 7:2 0 812K 1 loop /snap/gnome-logs/121
loop3 7:3 0 512K 1 loop /snap/gnome-characters/795
loop4 7:4 0 1.6M 1 loop /snap/gnome-system-monitor/186
loop5 7:5 0 497M 1 loop /snap/gnome-42-2204/141
loop6 7:6 0 2.5M 1 loop /snap/gnome-system-monitor/163
loop7 7:7 0 704K 1 loop /snap/gnome-characters/726
loop8 7:8 0 91.7M 1 loop /snap/gtk-common-themes/1535
loop9 7:9 0 241.4M 1 loop /snap/gnome-3-38-2004/70
loop10 7:10 0 61.8M 1 loop /snap/core20/1081
loop11 7:11 0 548K 1 loop /snap/gnome-logs/106
loop12 7:12 0 2.5M 1 loop /snap/gnome-calculator/884
loop13 7:13 0 55.7M 1 loop /snap/core18/2812
loop14 7:14 0 349.7M 1 loop /snap/gnome-3-38-2004/143
loop15 7:15 0 55.4M 1 loop /snap/core18/2128
loop16 7:16 0 4K 1 loop /snap/bare/5
loop17 7:17 0 219M 1 loop /snap/gnome-3-34-1804/72
loop18 7:18 0 2.2M 1 loop /snap/gnome-calculator/955
loop19 7:19 0 218.4M 1 loop /snap/gnome-3-34-1804/93
loop20 7:20 0 74.1M 1 loop /snap/core22/1033
loop21 7:21 0 63.9M 1 loop /snap/core20/2105
sda 8:0 0 3.7T 0 disk
├─sda1 8:1 0 476M 0 part
├─sda2 8:2 0 19.1G 0 part [SWAP]
├─sda3 8:3 0 19.1G 0 part /
└─sda4 8:4 0 3.6T 0 part /home
(4)、查看系统磁盘的物理结构和分布情况
sudo fdisk -l
(5)、查看当前文件夹下各个文件大小
ls -lh