Yet Another Way To Check Filesystem Space Use

Many tools do the same thing in Linux and this is just another way to check filesystem space use. This one isn’t all that special, it’s just another way. If you want to check your filesystem usage (basically, how much free space you have used on your storage devices) this article can help you with that.

This shouldn’t be a long article. I’ve written others on the topic. It’s safe to assume that you know what a filesystem is. It’s the system your hardware uses to store data if you don’t know. There are many types, from Ext3 to ExFAT. They are all filesystems used to store data.

It should go without saying that you can fill up your storage space and might want to know how much space you have available. Well, if you want to find that information, this is an article for you!

This is another application. There are others.

Monitor Disk Usage With GDU
Show Disk Usage With ‘ncdu’
How To: Check Disk Usage With ‘df’

Those are just a few applications that will let you monitor your filesystem’s usage. I’m sure I’ve covered others.

This pydf is a Python script, but we’ll be using Lubunt and installing pydf just like we’d install any other application, albeit in the terminal. I will point out that pydf has a colored output, which is nice.

I can’t say that this pydf is available in other distros, but it’s available in Lubuntu. As Lubuntu is Ubuntu, that means it’s available in Ubuntu. It is also likely available in Debian. I think you’ll find that pydf is also available in the downstream distros like Linux Mint. I did provide a link above that will take you to the project page.

Check Filesystem Space Usage:

As I’ve done the work in Lubuntu, these directions will be for Lubuntu. You can adapt them easily. In Lubuntu, you can open the terminal by pressing CTRL + ALT + T on your keyboard. That will open the default terminal.

With your terminal now open, you can install pydf with the following command:

If you want to check the man page (say with man pydf), you’ll find that there isn’t one. If you’d like to view the pydf’s help file, try this command:

Once you’ve done that, you’ll see that using pydf is quite simple. If you just want to run the program to check filesystem space use, then just run it in the terminal like so:

If you want the output in ‘human-readable’ format, you can add a -h flag where bits are divided by 1024, or -H which means bits are divided by 1000. The choice is up to you.

Likewise, if you want to see even the zero-byte filesystems (the special filesystems that you don’t work directly with), you’d run this command:

Additionally, there’s a -l flag that limits the output to just the local filesystems. If I combine them for my preferred output, I get this:

Here’s an example output:

As you can see, there are a bunch of loop devices which are Snaps, which is perfectly normal for many Ubuntu-based systems. You can also see that I’ve used slightly more than half of my drive space and clever observers would notice that the drive is an NVMe SSD.

Closure:

So, that was a quick and easy article about how you can check filesystem space use, specifically in Lubuntu but easily applied to other distros. There are many ways to accomplish this task in Linux, which means this is just one among many such tools. It shouldn’t take too long to learn how to use pydf if that’s the tool you want to use.

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 site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Show Disk Usage With ‘ncdu’

In today’s article, we’re going to learn how to show disk usage with ‘ncdu’. It’ll be a fun terminal exercise that lets you see your disk usage. I’d say this is on par with a beginner article, ’cause it’s just some simple terminal commands. So, do read on!

If you think ‘ncdu’ sounds familiar, it may be from a previous article. You should probably read the intro to that article, as it will save you some time and is reasonably informative.

How To: Find Large Files Using ‘ncdu’

We’ll be using that same tool, but we’ll be using it in a different manner. That article explains what ‘ncdu’ is. In short, it stands NCurses Disk Usage and it’s a handy enough tool. It describes itself as:

ncdu – NCurses Disk Usage

There are a few ways to use ‘ncdu’ and we’ll be using it to show disk usage in this article. Because you have that handy link up there, I’m going to skip some sections of this article.

Show Disk Usage With ‘ncdu’:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

First, you’re going to need to install ‘ncdu’. Rather than duplicate work, please visit this article. Scroll down and you’ll see how to install ‘ncdu’. 

See? All these previous articles sure make some future articles easier.

Anyhow, now that you have ‘ncdu’ installed, just navigate to the root directory run ‘ncdu’ from the there.

Depending on how much disk space you have attached to your system at the time, it could take a while to run. Let it run and eventually you’ll end up with a screen like this:

ncdu in action
Pretty basic looking, right? Well, look deeper.

As you can see, the first line is highlighted. Well, use the arrow keys to move up and down. Then, use the left and right arrow keys to move back and forth. To keep it simple, if you want to dig deeper, just navigate to the directory you’re curious about and run ‘ncdu’ in that directory.

Hmm… I probably should have timed it. I set ‘ncdu’ running on a desktop with a couple of internal disks and attached to an external disk with a whole lot of files on it. It’s like an 8 TB disk and the system is still trying to process that bad boy.

ncdu can take a long time to run...
It has been a while… It’s okay, I have faith, It’ll finish someday!

Anyhow, read the man page:

There’s more to be done with ‘ncdu’ when you want to explore disk usage. It can take a minute or ten to run, but the information is worth it.

Closure:

There you have it, a fairly short article that explains how to show disk usage with ‘ncdu’. It seemed like a good article to write and it was nice having already covered so much of it. That saves some time and I was a bit late in writing this one.

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.

How To: Free Some Disk Space By Deleting Old Logs

In today’s article, we’re going to free up some of your disk space by deleting old logs. It’s a relatively safe and easy thing to do, and can free some space up if you’re running low. Unless there’s a problem, you really don’t need a bunch of old logs kicking around and taking up space.

There are other reasons for deleting old logs, such as keeping things tidy or even ensuring old activities aren’t easily discovered by browsing old log files. You may have done some debugging and now want to start with a new slate, so there’s another reason to delete logs. 

Who knows what motivations you’ll have, but today we’ll be covering how to do it. The tool we’ll be using for log cleaning is ‘journalctl’, which is used for (according to the man page):

journalctl – Query the systemd journal

While ‘journalctl’ is a pretty nifty tool, we’re only going to scratch the surface. This article is only about deleting old logs and ‘journalctl’ is just the tool we’ll be using. If you want an article about all the features of ‘journalctl’, this is not that article. See? I’m saving at least a few people some time!

Anyhow, this article obviously requires a distro that uses ‘systemd’. If you don’t have ‘systemd’, you probably don’t have ‘journalctl’ and you’ll have to find another way to delete your logs. As most mainstream distros are using ‘systemd’, there’s a pretty good chance that you have ‘journalctl’ available.

So, with all that preamble gibberish out of the way, let’s go about …

Deleting Old Logs:

Like oh so many articles here, this one requires an open terminal. Why? Because of course it does. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

Now, with your terminal open, let’s have a look and see how much space your logs are taking up. You can do that with this command:

Now that you’ve seen how much space your logs are taking up, there are a couple of commands you can use for deleting old logs. If you want to go by space, you can use this command:

You can edit the ‘100m’ to whatever suits your needs. You can also use ‘g’ for gigabytes if you’d like to keep using that much log space.

If you want, you can also delete your old logs by the day. Let’s say you want to retain the last 3 days of logs. Well, that command would be:

I suspect you can figure out that the ‘d’ stands for ‘day’ and the 3 is how many days. You can, of course, change that to any number of days you wish. If you want, you can even use ‘w’ for weeks. Though, if you’re deleting log files to clear up disk space, you’re probably going to want to trim the logs even more than that.

Anyhow, when you’re done running one of the cleaning commands from above, you can verify that the space has been cleaned by running the very first command listed. That will do exactly what it did the first time you ran it – it’ll tell you how much space your logs are taking up. If they’re still not small enough for your liking, feel free to edit and run one of the above commands a second time.

Closure:

Well, there you have it… You have another article! This time I tell you how to go about cleaning old logs from your system. It’s a handy skill to have, though most folks probably have ample disk space – except those running on stuff like Chromebooks or the likes. If you’ve gotta live within 16 GB, you’re going to want to keep your logging to a minimum. Also, I still haven’t skipped a day from writing articles. It seems likely that I’ll do so eventually!

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.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.