July 16, 2023

Find out what takes up disk space on your drive

Run the command line du incrementally starting from the home directory and then narrowing down directory after directory to find out what items take up space.

Start by running:

$ du -hxd 1 / | sort -h | less

(Run $ man du to check what the options -hxd are about.)

You should see something like:

280K    /home/user/.abook
380K    /home/user/Desktop
388K    /home/user/.gnupg
1.1M    /home/user/Templates
2.8M    /home/user/.nvm
4.5M    /home/user/.vim
20M     /home/user/.icedove
54M     /home/user/.npm
182M    /home/user/.config
303M    /home/user/.cache
1.8G    /home/user/.local
7.3G    /home/user/Documents
7.3G    /home/user/Mail
8.4G    /home/user/Music
23G     /home/user/Pictures
154G    /home/user/Downloads
204G    /home/user/

The number in the last row (i.e. 204G) is the sum of all of the above.

You can see that the directory Download is 154 GB.

To check what takes space in the directory Download, run:

$ du -hxd 1 /home/user/Downloads/ | sort -h | less

And move down other directories to figure what takes up disk space, and so on.

To learn more about du run $ man du.

command-line interface (cli) personal computing gnu linux trisquel office applications wiki shell literacy

No affiliate links, no analytics, no tracking, no cookies. © 2016-2023 yctct.com. Content is licensed under CC BY-NC-SA 4.0 .