Tuesday, October 23, 2012

Largest Folder in Linux

There are times when you are suddenly surprised when you start running out of diskspace. When this occurs, sometimes you might know what is taking up all your precious space, and sometimes you don't.

If you don't really have an understanding what is taking up all your space, then what you really want to do is get a view, starting from the root and showing which folders are taking up the space.

 There's a great little program that will do just that. To install it, whip out a terminal window and type in :

sudo apt-get install ncdu 

and then once it is installed type in ncdu. Depending on where you execute the command it will take list the folders and files from that location. If you want to start it from the root folder simply pass in an argument of the root path i.e ncdu /.


A word of warning when you pass this through with the root path, if you have external drives and other harddrives mounted in /mnt or /media the ncdu will take the mounted harddrives into consideration.

The difference between my previous post (du -hs /mypath/) is that ncdu will outline the files and folders and list their sizes, it also adds interactivity by allowing you to drill into folders. So in an example where you start looking at the entire filesystem from the root path, you can see the larger directories. From there you can enter the directory or your choice, and then see the sizes of the sub-directory. This feature is handy when you don't know where to start (start at the top).
There 

 

0 comments:

Post a Comment