get size of folders on root directory

sa flag

My root directory "/" on my ubuntu server is filling up. I'd like to look at the folders in it and try to spot what's filling up. Can someone please tell me how to show the sizes of the folders in the root directory "/" (I think that's root, I always get confused with home "~")

Also is there a way to show the size of folders on a file system "/dev/nvme1n1p2"


df -h /


Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme1n1p2  228G  213G  3.8G  99% /
pLumo avatar
in flag
Try `ncdu` <---
user535733 avatar
cn flag
Or this possible duplicate: [What's a command line way to find large files/directories to remove and free up space?](
ec flag

Yes! You could try du -chd1 /.

This will give you output similar to the following:

4.3G    /var
264M    /opt

Then to narrow down results you could replace / with any folder you'd like, such as du -chd1 /var

EDIT: I have edited the command with the suggestion from muru, and now this will include dot folders if scanning something like your home directory.

muru avatar
us flag
Instead of `-s /*`, you should use `-d1 /`. Otherwise you might miss dot folders in `/` (unlikely, but if you're looking to free up space, then accidentally created folders are often candidates)
ryan77627 avatar
ec flag
Ah, you're right. I always forget to include the dot folders whenever I use * (whether that be copying or otherwise). Thanks!

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.