In this article, we’ll learn how to find large files by using ‘ncdu’. It’s useful for spotting large files that eat up your disk space. We’ve previously had an article about visualizing disk usage. Those were some great GUI ways to find large file, but this will be done inside your terminal – and using ncdu.
You’ll find that ‘ncdu‘ stands for NCurses Disk Usage. As the link says, it refers to the similarity with ‘du’ and that it uses the [n]curses programming language. As far as tools like this go, this one is relatively new (from 2007). Unsurprisingly, ncdu defines itself as:
ncdu – NCurses Disk Usage
There are a ton of options for ncdu and we’re only going to touch on just one of ’em. The goal isn’t to teach you how to use ncdu, it’s to teach you how to use ncdu to find large files. If you want to learn more about the tool, you can always refer to the man page.
Now that we understand the scope of this article (how to find large files using ncdu) we can move on into it…
Find Large Files Using ncdu:
Chances are good that ncdu isn’t installed by default and you’ll need to install it. It’s also a text-based application. So, obviously, you’re going to need a terminal open. You can easily open a terminal by pressing
Now, you’re going to need to install ncdu, and one of the following commands should cover the most popular distros:
Fedora:
1 | sudo dnf install ncdu |
Debian/Ubuntu:
1 | sudo apt install ncdu |
Manjaro/Arch: (Note: Should work, threw PGP error in my testing VM.)
1 | sudo pacman -S ncdu |
openSUSE/SUSE:
1 | sudo zypper install ncdu |
RHEL/CentOS: (Note: Needs epel-release.)
1 2 | sudo yum install epel-release sudo yum install ncdu |
Or whatever… It’s available for any distro I could think of to check, and it’s trivial to install it. If you’ve been following this site long enough, you can figure it out. I have the greatest confidence in your ability to get it installed!
That said and done, all I’m going to teach you is how to use it with no flags or anything of the sort. Yup… I wrote all this just to show you a single use type of ncdu.
Basically, for the exercise today, all you need to do is change to the directory you’re curious about and then you’ll just run ncdu in that directory. So, as you just opened your terminal and installed ncdu, you can just run it right there in your /home/<user> directory. It looks like this:
1 | ncdu |
If you want to run it on the root of your drive, just navigate to it and run ncdu
all over again. Sure, you can specify the directory or you can just be a lazy bum and navigate to the directory and simply run ncdu
without any flags at all.
If you run it in your home directory, it’ll just be the files that belong to you. But, you can navigate to any directory and just run the command. In your home folder, it might look a little something like this:
To navigate, you just use your arrow keys. Up and down to pick the directory, forward and backward to enter and exit the directories. For example, when I dig down into my VirtualBox virtual machines directory, I get a screen that’s even more informative. Like this:
Anyhow, I’m sure you can figure this out. Use your arrow buttons and explore. Heck, go to the root directory and explore your system until you’re happy and content! Trust me on this one, you have the capacity to figure this out.
Now, before I go, I’d be remiss in my duties if I didn’t strongly suggest you read the actual man page. There’s a whole lot more to this tool. Using it this way is kinda like using a hammer to bake cookies, or some other horrible analogy. But, it does work. It does give you the information you need. Best of all, it does it without any necessary complexity.
Closure:
And there it is! Yet another article is said and done. This one will show you how to use ncdu in the terminal to find large files. If you’re ever unable to use a GUI, this is an excellent tool to determine file sizes. You never know when you’ll need such a tool.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.