General

How To: Find Large Files Using ‘ncdu’

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 CTRL + ALT + T. That should open your default terminal.

Now, you’re going to need to install ncdu, and one of the following commands should cover the most popular distros:

Fedora:

sudo dnf install ncdu

Debian/Ubuntu: 

sudo apt install ncdu

Manjaro/Arch: (Note: Should work, threw PGP error in my testing VM.)

sudo pacman -S ncdu

openSUSE/SUSE:

sudo zypper install ncdu

RHEL/CentOS: (Note: Needs epel-release.)

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:

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:

See? It should be pretty self explanatory from here on out. Navigation is easy.

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:

As you can see, you can dig down quite nicely and find the file sizes.

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.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Enable/Disable Your Network Interface

Today we'll cover one way to enable or disable your network interface in the Linux…

6 months ago

Check Your NIC Speed In The Terminal

Today's exercise is a nice and simple exercise where we check your NIC speed in…

6 months ago

Easily Monitor Your Wireless Connection

Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…

6 months ago

Count The Files In A Directory

I think I've covered this before with the ls command but this time we'll count…

6 months ago

Get System Information With The ‘uname’ Command In Linux

Today we'll be learning about a basic Linux command that's known as 'uname' and it…

6 months ago

hardinfo Has Been Rebooted As hardinfo2

If you've used hardinfo in the past, it may interest you to know that hardinfo…

6 months ago