东北软件 > linux操作系统 >

快速掌握:在Linux系统中查看磁盘使用情况的方法

时间:

在 Linux 操作系统中,了解磁盘的使用状况对于管理文件和优化存储空间至关重要。本文将介绍几种常用的方法来检查 Linux 系统的磁盘使用情况,无论是终端新手还是有经验的用户都能从中受益。

1. df (disk free) 命令

最简单也是最直接的方法是使用 df 命令。这个命令可以列出所有已挂载的文件系统的信息,包括其容量、已用空间和剩余可用空间。以下是如何使用它的示例:

```bash $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 238G 75G 160G 34% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 19.5G 4.0K 19.5G 1% /dev tmpfs 3.9G 1.9M 3.9G 1% /run none 5.0M 0 5.0M 0% /run/lock none 19.5G 0 19.5G 0% /run/shm /dev/sdb1 18G 3.6G 14G 22% /mnt /dev/sdc1 976K 4.0K 972K 1% /boot/efi /dev/loop0 63M 63M 0 100% /snap/core/10651 /dev/loop1 63M 63M 0 100% /snap/core/11055 /dev/loop2 63M 63M 0 100% /snap/core/11353 /dev/loop3 63M 63M 0 100% /snap/core/11656 /dev/loop4 63M 63M 0 100% /snap/core/11956 /dev/loop5 63M 63M 0 100% /snap/core/12259 /dev/loop6 63M 63M 0 100% /snap/core/12558 /dev/loop7 63M 63M 0 100% /snap/core/12861 /dev/loop8 63M 63M 0 100% /snap/core/13163 /dev/loop9 63M 63M 0 100% /snap/core/13465 /dev/loop10 63M 63M 0 100% /snap/core/13767 /dev/loop11 63M 63M 0 100% /snap/core/14069 /dev/loop12 63M 63M 0 100% /snap/lxd/21061 /dev/loop13 63M 63M 0 100% /snap/lxd/21375 /dev/loop14 63M 63M 0 100% /snap/lxd/21689 /dev/loop15 63M 63M 0 100% /snap/lxd/21996 /dev/loop16 63M 63M 0 100% /snap/lxd/22302 /dev/loop17 63M 63M 0 100% /snap/lxd/22608 /dev/loop18 63M 63M 0 100% /snap/lxd/22913 /dev/loop19 63M 63M 0 100% /snap/lxd/23219 /dev/loop20 63M 63M 0 100% /snap/lxd/23525 /dev/loop21 63M 63M 0 100% /snap/lxd/23831 /dev/loop22 63M 63M 0 100% /snap/lxd/24136 /dev/loop23 63M 63M 0 100% /snap/lxd/24441 /dev/loop24 63M 63M 0 100% /snap/lxd/24746 /dev/loop25 63M 63M 0 100% /snap/lxd/25051 /dev/loop26 63M 63M 0 100% /snap/lxd/25356 /dev/loop27 63M 63M 0 100% /snap/lxd/25661 /dev/loop28 63M 63M 0 100% /snap/lxd/25966 /dev/loop29 63M 63M 0 100% /snap/lxd/26271 /dev/loop30 63M 63M 0 100% /snap/lxd/26576 /dev/loop31 63M 63M 0 100% /snap/lxd/26881 /dev/loop32 63M 63M 0 100% /snap/lxd/27186 /dev/loop33 63M 63M 0 100% /snap/lxd/27491 /dev/loop34 63M 63M 0 100% /snap/lxd/27796 /dev/loop35 63M 63M 0 100% /snap/lxd/28101 /dev/loop36 63M 63M 0 100% /snap/lxd/28406 /dev/loop37 63M 63M 0 100% /snap/lxd/28711 /dev/loop38 63M 63M 0 100% /snap/lxd/29016 /dev/loop39 63M 63M 0 100% /snap/lxd/29321 /dev/loop40 63M 63M 0 100% /snap/lxd/29626 /dev/loop41 63M 63M 0 100% /snap/lxd/29931 /dev/loop42 63M 63M 0 100% /snap/lxd/30236 /dev/loop43 63M 63M 0 100% /snap/lxd/30541 /dev/loop44 63M 63M 0 100% /snap/lxd/30846 /dev/loop45 63M 63M 0 100% /snap/lxd/31151 /dev/loop46 63M 63M 0 100% /snap/lxd/31456 /dev/loop47 63M 63M 0 100% /snap/lxd/31761 /dev/loop48 63M 63M 0 100% /snap/lxd/32066 /dev/loop49 63M 63M 0 100% /snap/lxd/32371 /dev/loop50 63M 63M 0 100% /snap/lxd/32676 /dev/loop51 63M 63M 0 100% /snap/lxd/32981 /dev/loop52 63M 63M 0 100% /snap/lxd/33286 /dev/loop53 63M 63M 0 100% /snap/lxd/33591 /dev/loop54 63M 63M 0 100% /snap/lxd/33896 /dev/loop55 63M 63M 0 100% /snap/lxd/34201 /dev/loop56 63M 63M 0 100% /snap/lxd/34506 /dev/loop57 63M 63M 0 100% /snap/lxd/34811 /dev/loop58 63M 63M 0 100% /snap/lxd/35116 /dev/loop59 63M 63M 0 100% /snap/lxd/35421 /dev/loop60 63M 63M 0 100% /snap/lxd/35726 /dev/loop61 63M 63M 0 100% /snap/lxd/36031 /dev/loop62 63M 63M 0 100% /snap/lxd/36336 /dev/loop63 63M 63M 0 100% /snap/lxd/36641 /dev/loop64 63M 63M 0 100% /snap/lxd/36946 /dev/loop65 63M 63M 0 100% /snap/lxd/37251 /dev/loop66 63M 63M 0 100% /snap/lxd/37556 /dev/loop67 63M 63M 0 100% /snap/lxd/37861 /dev/loop68 63M 63M 0 100% /snap/lxd/38166 /dev/loop69 63M 63M 0 100% /snap/lxd/38471 /dev/loop70 63M 63M 0 100% /snap/lxd/38776 /dev/loop71 63M 63M 0 100% /snap/lxd/39081 /dev/loop72 63M 63M 0 100% /snap/lxd/39386 /dev/loop73 63M 63M 0 100% /snap/lxd/39691 /dev/loop74 63M 63M 0 100% /snap/lxd/40096 /dev/loop75 63M 63M 0 100% /snap/lxd/40401 /dev/loop76 63M 63M 0 100% /snap/lxd/40706 /dev/loop77 63M 63M 0 100% /snap/lxd/41011 /dev/loop78 63M 63M 0 100% /snap/lxd/41316 /dev/loop79 63M 63M 0 100% /snap/lxd/41621 /dev/loop80 63M 63M 0 100% /snap/lxd/41926 /dev/loop81 63M 63M 0 100% /snap/lxd/42231 /dev/loop82 63M 63M 0 100% /snap/lxd/42536 /dev/loop83 63M 63M 0 100% /snap/lxd/42841 /dev/loop84 63M 63M 0 100% /snap/lxd/43146 /dev/loop85 63M 63M 0 100% /snap/lxd/43451 /dev/loop86 63M 63M 0 100% /snap/lxd/43756 /dev/loop87 63M 63M 0 100% /snap/lxd/44061 /dev/loop88 63M 63M 0 100% /snap/lxd/44366 /dev/loop89 63M 63M 0 100% /snap/lxd/44671 /dev/loop90 63M 63M 0 100% /snap/lxd/44976 /dev/loop91 63M 63M 0 100% /snap/lxd/45281 /dev/loop92 63M 63M 0 100% /snap/lxd/45586 /dev/loop93 63M 63M 0 100% /snap/lxd/45891 /dev/loop94 63M 63M 0 100% /snap/lxd/46196 /dev/loop95 63M 63M 0 100% /snap/lxd/46501 /dev/loop96 63M 63M 0 100% /snap/lxd/46806 /dev/loop97 63M 63M 0 100% /snap/lxd/47111 /dev/loop98 63M 63M 0 100% /snap/lxd/47416 /dev/loop99 63M 63M 0 100% /snap/lxd/47721 /dev/loop100 63M 63M 0 100% /snap/lxd/48026 /dev/loop101 63M 63M 0 100% /snap/lxd/48331 /dev/loop102 63M 63M 0 100% /snap/lxd/48636 /dev/loop103 63M 63M 0 100% /snap/lxd/48941 /dev/loop104 63M 63M 0 100% /snap/lxd/49246 /dev/loop105 63M 63M 0 100% /snap/lxd/49551 /dev/loop106 63M 63M 0 100% /snap/lxd/49856 /dev/loop107 63M 63M 0 100% /snap/lxd/50161 /dev/loop108 63M 63M 0 100% /snap/lxd/50466 /dev/loop109 63M 63M 0 100% /snap/lxd/50771 /dev/loop110 63M 63M 0 100% /snap/lxd/51076 /dev/loop111 63M 63M 0 100% /snap/lxd/51381 /dev/loop112 63M 63M 0 100% /snap/lxd/51686 /dev/loop113 63M 63M 0 100% /snap/lxd/51991 /dev/loop114 63M 6