Home Blog Gallery

Shell Addendum A, file sizes

published Sat May 02 2026 23:29:37 GMT-0400 (Eastern Daylight Time)

this is a micro-sidebar-thingo, because i ran out of disk space on my desktop! D: from all the music from bandcamp I was legally downloading, and all. I'll instead use screenshots from my VPS machine. no worries.

anyways, some little tricks:

to check your partitions (same as opening 'This PC') on windows

kit@alloyed1 ~> df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           390M  1.2M  389M   1% /run
efivarfs        256K   60K  192K  24% /sys/firmware/efi/efivars
/dev/vda2        24G   15G  7.3G  68% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/vda1       1.1G  6.2M  1.1G   1% /boot/efi
tmpfs           390M   12K  390M   1% /run/user/1001

"-h" stands for "human readable numbers", and many commands support it, just replaces raw lists of bytes with "1.1G" (meaning 1.1 gigabytes) and so on. let's drill into the /

kit@alloyed1 ~> sudo du -had 1 / | sort -h
du: cannot access '/proc/412627/task/412627/fd/4': No such file or directory
du: cannot access '/proc/412627/task/412627/fdinfo/4': No such file or directory
du: cannot access '/proc/412627/fd/3': No such file or directory
du: cannot access '/proc/412627/fdinfo/3': No such file or directory
0	/bin
0	/dev
0	/lib
0	/lib64
0	/proc
0	/sbin
0	/sys
4.0K	/bin.usr-is-merged
4.0K	/cdrom
4.0K	/lib.usr-is-merged
4.0K	/media
4.0K	/mnt
4.0K	/opt
4.0K	/sbin.usr-is-merged
4.0K	/srv
8.0K	/snap
16K	/lost+found
84K	/root
100K	/tmp
1.2M	/run
17M	/etc
207M	/boot
1.3G	/var
3.9G	/swap.img
4.8G	/home
4.9G	/usr
15G	/

-h is human-readable again. -a means "list files and directories". -d 1 means "only recurse 1 level deep". different numbers produce more detailed reports! but this is fine for me.

| sort -h pushes the largest numbers to the bottom, taking into account the human-readable format, which is handy. (I know I haven't explained | yet! when I do, and if i remember to, I'll link an explanation here).

From this we know our 15G of used space is about equally split between /usr(where system packages are installed), /home (where your personal files are stored), and /swap.img , which is a magic file that acts as backup RAM if you run out. I know I don't need to do anything here, but if i did care I'd probably look into each folder individually to check.

i know i accidentally downloaded the same thing twice on my desktop, so I'll introduce a custom tool to do something about this:

sudo apt install fdupes

(you can also do this with a shell script. but. the performance benefits of a dedicated tool are nice.)

kit@alloyed1 ~> fdupes -cr --size shared
27868 bytes each:
shared/2024/cohost live!.png
shared/2024/cohost_live.png

3473068 bytes each:
shared/2024/kit export packed.fbx
shared/2024/kit_export_packed.fbx

4304207 bytes each:
shared/2024/Look Into The Heart Now [vXoiyzy3Vys].mp3
shared/2024/crunch_lithn.mp3

hehe oops. ok

kyle@alloyed1 ~> fdupes -cr --size --delete shared

screenshot of the fdupes TUI for interactively picking which files to delete

(i should make a quick script to auto-explain the flags i use in these. maybe next time, lol)

tagged with: #kit techtips #bash