こんにちは、LinuCエバンジェリストこと、鯨井貴博@opensourcetechです。
Debian系(Debian/Ubuntu/Rasbianなど)を使った時の不要ファイル削除方法のメモです。
※Raspberry Piなど容量の小さめのSDカードを使っている時にはいいかも。
apt
apt autoremove --purgeで不要なパッケージを削除します。
apt remove --purgeで未使用のソフトウェアを削除するのもいいでしょう。
apt(8) — apt — Debian stretch — Debian Manpages
root@raspberrypi:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 4.9G 2.0G 72% /
devtmpfs 213M 0 213M 0% /dev
tmpfs 217M 0 217M 0% /dev/shm
tmpfs 217M 3.1M 214M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 217M 0 217M 0% /sys/fs/cgroup
/dev/mmcblk0p1 43M 22M 21M 52% /boot
tmpfs 44M 0 44M 0% /run/user/1000
root@raspberrypi:~# apt autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
lxkeymap* python-cairo* python-gobject* python-gobject-2* python-gtk2*
python-xklavier* realpath*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
After this operation, 4,722 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 127805 files and directories currently installed.)
Removing lxkeymap (0.8.0~bzr25-1+rpi3) ...
Removing python-gtk2 (2.24.0-5.1) ...
Removing python-cairo (1.8.8-2.2) ...
Removing python-xklavier (0.4-4) ...
Removing python-gobject (3.22.0-2) ...
Removing python-gobject-2 (2.28.6-13) ...
Removing realpath (8.26-3) ...
Processing triggers for mime-support (3.60) ...
Processing triggers for desktop-file-utils (0.23-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for gnome-menus (3.13.3-9) ...
Filesystem Size Used Avail Use% Mounted on
/dev/root 7.3G 4.9G 2.0G 72% /
devtmpfs 213M 0 213M 0% /dev
tmpfs 217M 0 217M 0% /dev/shm
tmpfs 217M 3.1M 214M 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 217M 0 217M 0% /sys/fs/cgroup
/dev/mmcblk0p1 43M 22M 21M 52% /boot
tmpfs 44M 0 44M 0% /run/user/1000
root@raspberrypi:~# apt autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
lxkeymap* python-cairo* python-gobject* python-gobject-2* python-gtk2*
python-xklavier* realpath*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
After this operation, 4,722 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 127805 files and directories currently installed.)
Removing lxkeymap (0.8.0~bzr25-1+rpi3) ...
Removing python-gtk2 (2.24.0-5.1) ...
Removing python-cairo (1.8.8-2.2) ...
Removing python-xklavier (0.4-4) ...
Removing python-gobject (3.22.0-2) ...
Removing python-gobject-2 (2.28.6-13) ...
Removing realpath (8.26-3) ...
Processing triggers for mime-support (3.60) ...
Processing triggers for desktop-file-utils (0.23-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for gnome-menus (3.13.3-9) ...
apt-get
apt-get remove(--purge)やapt-get purgeで同様のことが可能です。
apt-get(8) — apt — Debian stretch — Debian Manpages