我的磁盘上只有几个文件,但是有些文件占用了大部分磁盘空间,我该如何检查并删除这些不必要的文件?
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 2.1M 1.6G 1% /run
/dev/sda7 79G 56G 19G 76% /
tmpfs 7.8G 8.4M 7.8G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/loop1 55M 55M 0 100% /snap/core18/1650
/dev/loop0 145M 145M 0 100% /snap/slack/19
/dev/loop5 141M 141M 0 100% /snap/gnome-3-26-1604/97
/dev/loop7 90M 90M 0 100% /snap/core/8268
/dev/loop9 1.0M 1.0M 0 100% /snap/gnome-logs/61
/dev/loop10 4.3M 4.3M 0 100% /snap/gnome-calculator/544
/dev/loop6 15M 15M 0 100% /snap/gnome-characters/375
/dev/loop12 141M 141M 0 100% /snap/gnome-3-26-1604/98
/dev/loop4 15M 15M 0 100% /snap/gnome-characters/399
/dev/loop2 55M 55M 0 100% /snap/core18/1279
/dev/loop13 90M 90M 0 100% /snap/core/8213
/dev/loop11 157M 157M 0 100% /snap/gnome-3-28-1804/110
/dev/loop14 3.8M 3.8M 0 100% /snap/gnome-system-monitor/127
/dev/loop15 3.8M 3.8M 0 100% /snap/gnome-system-monitor/123
/dev/loop16 45M 45M 0 100% /snap/gtk-common-themes/1353
/dev/loop8 4.3M 4.3M 0 100% /snap/gnome-calculator/501
/dev/loop3 174M 174M 0 100% /snap/skype/109
/dev/loop17 185M 185M 0 100% /snap/eclipse/40
/dev/loop19 181M 181M 0 100% /snap/spotify/35
/dev/loop18 135M 135M 0 100% /snap/slack/20
/dev/loop20 161M 161M 0 100% /snap/gnome-3-28-1804/116
/dev/loop21 45M 45M 0 100% /snap/gtk-common-themes/1440
/dev/loop22 182M 182M 0 100% /snap/spotify/36
/dev/loop23 1.0M 1.0M 0 100% /snap/gnome-logs/81
/dev/loop24 173M 173M 0 100% /snap/skype/101
/dev/sda1 646M 62M 585M 10% /boot/efi
tmpfs 1.6G 20K 1.6G 1% /run/user/120
tmpfs 1.6G 52K 1.6G 1% /run/user/1000
答案1
/dev/sda7 79G 56G 19G 76% /
/
是整个系统的根目录。随意删除其中的文件/目录/
并不是一个好主意。
要查看大型打开的文件:
sudo lsof / | awk '{if($7 > 1048576) print $7/1048576 "MB" " " $9 }' | sort -n -u
要查看已打开但已删除的文件,
sudo lsof / | grep -E 'PID|\(deleted\)'