If you wish to make a meticulous and detailed removal that takes some time but has the advantage of precision, the following is an example using a live disk:
Boot the live disk and run
lsblk:
Code:
[~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sr0 11:0 1 1024M 0 rom
nvme0n1 259:0 0 465.8G 0 disk
├─nvme0n1p1 259:1 0 476M 0 part /boot/efi
├─nvme0n1p2 259:2 0 14.9G 0 part [SWAP]
└─nvme0n1p3 259:3 0 450.4G 0 part /
<snip>
There's only a root partition, so that can be mounted on the directory /mnt:
Code:
# mount /dev/nvme0n1p3 /mnt
To find out where the largest files are, one can run a command like the following. I'll leave the description of the options for the reader to unravel from the man pages:
Code:
# du -hx /mnt | sort -hr | head -n 10
35G /mnt/home/ben
9.1G /mnt/home/ben/sundry/ufn
9.1G /mnt/home/ben/sundry
6.1G /mnt/home/ben/sundry/ufn/old
5.8G /mnt/home/ben/browsers
4.4G /mnt/home/ben/music
4.1G /mnt/home/ben/music/tunes
3.7G /mnt/home/ben/music/tunes/musicbooks
3.0G /mnt/home/ben/Downloads
2.7G /mnt/home/ben/lemon
The output shows a bunch of directories where the big files are. Looking into one of those directories for example:
Code:
# ls -al /mnt/home/ben/sundry/ufn
total 40
drwxrwxr-x 9 ben ben 4096 Mar 27 17:08 .
drwxr-xr-x 5 ben ben 4096 Apr 27 11:02 ..
drwxrwxr-x 2 ben ben 4096 Mar 27 17:06 ff
drwxrwxr-x 2 ben ben 4096 Mar 27 17:06 fm
drwxrwxr-x 2 ben ben 4096 Mar 27 17:06 mfj
drwxrwxr-x 2 ben ben 4096 Mar 27 17:07 moso
drwxrwxr-x 2 ben ben 4096 Mar 27 17:07 msg
drwxrwxr-x 2 ben ben 4096 Mar 27 17:08 mst
drwxrwxr-x 2 ben ben 4096 Mar 27 17:08 rn
Then finding the space they all take:
Code:
# du -sh /mnt/home/ben/sundry/ufn
6.1G .
The output shows 6.1G. If all of that can be dispensed with, including all of those directories and files, run:
Code:
# rm -rf /mnt/home/ben/sundry/ufn/old/*
Otherwise you can look into one of those directories, find out how much space it takes up, and just remove what is there:
Code:
# ls -al /mnt/sundry/ufn/old/moso
total 1.5G
-rw-rw-r-- 1 ben ben 32M Mar 27 17:06 10-1.mp4
-rw-rw-r-- 1 ben ben 28M Mar 27 17:06 10-2.mp4
-rw-rw-r-- 1 ben ben 34M Mar 27 17:07 10-3.mp4
-rw-rw-r-- 1 ben ben 33M Mar 27 17:07 10.mp4
-rw-rw-r-- 1 ben ben 37M Mar 27 17:07 1130.mp4
-rw-rw-r-- 1 ben ben 37M Mar 27 17:07 11.mp4
-rw-rw-r-- 1 ben ben 45M Mar 27 17:07 16.mp4
-rw-rw-r-- 1 ben ben 67M Mar 27 17:07 18.mp4
-rw-rw-r-- 1 ben ben 68M Mar 27 17:06 21x4.mp4
-rw-rw-r-- 1 ben ben 9.0M Mar 27 17:07 2.mp4
-rw-rw-r-- 1 ben ben 111M Mar 27 17:07 35.mp4
-rw-rw-r-- 1 ben ben 130M Mar 27 17:07 36.mp4
-rw-rw-r-- 1 ben ben 127M Mar 27 17:07 40.mp4
-rw-rw-r-- 1 ben ben 202M Mar 27 17:07 54.mp4
-rw-rw-r-- 1 ben ben 206M Mar 27 17:06 58.mp4
-rw-rw-r-- 1 ben ben 224M Mar 27 17:07 62.mp4
-rw-rw-r-- 1 ben ben 26M Mar 27 17:06 8.mp4
-rw-rw-r-- 1 ben ben 31M Mar 27 17:07 9-43.mp4
The
ls command above shows the space taken up as 1.5G. One can also run the
du command to see:
Code:
# du -sh /mnt/home/ben/sundry/ufn/old/moso
1.5G .
If the files are expendable, they can be removed with:
Code:
# rm /mnt/sundry/ufn/old/moso/*
When the work is finished, one unmounts the /mnt directory:
Then poweroff and withdraw the live disk, and boot the system to see if it runs. Linux systems run well when under about 85% full. They can get sluggish in the mid 90s and fail in the late 90s.