There are a few ways to see how much free or used disk space in linux;
The easiest way is to use:
If you want to drill down and find where all your disk space has gone, then ncdu is the best too, all day.
On Ubuntu you can apt install this repo, else there are installation instructions on their site.
sudo apt install ncdu
Once installed run this to see an overview;
sudo ncdu -rx /
Here is an example output from server I’m looking at today;
30.5 GiB [##########] /var 4.4 GiB [# ] /home 1.2 GiB [ ] /usr 646.7 MiB [ ] /lib 295.5 MiB [ ] /opt 14.3 MiB [ ] /bin 13.8 MiB [ ] /sbin 6.0 MiB [ ] /etc 32.0 KiB [ ] /tmp 20.0 KiB [ ] /root e 16.0 KiB [ ] /lost+found 8.0 KiB [ ] /media 4.0 KiB [ ] /lib64 e 4.0 KiB [ ] /srv e 4.0 KiB [ ] /snap e 4.0 KiB [ ] /mnt > 0.0 B [ ] /sys > 0.0 B [ ] /run > 0.0 B [ ] /proc > 0.0 B [ ] /dev > 0.0 B [ ] /boot
You can see my
home directory and the
/var directories are the largest.
I found an sql dump file in my home directory that I backed up then deleted.
This is a database/mysql server so to drill down and see in var where all my space was, I ran the same command and added the path on;
sudo ncdu -rx /var sudo ncdu -rx /var/lib
You can also use your up/down cursor keys to navigate to a directory in the tool and hit enter to inspect that,
I hope the ncdu command saves you hours of time tracking down where your space has gone!