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.

Gather Storage Disk Information With ‘smartctl’

This will be a fairly universal article, useful for various distros, for those who want to gather storage disk information with smartctl. This is not a very taxing article, and more could be written, but we’ll simply be using smartctl to gather basic storage device information.

Habit means I want to type ‘hard disk’. I’ll refrain from doing so. I guess I could call them ‘storage drives’ but I’m just going to call them ‘storage disks’, or ‘disk’ when I am referring to the singular.

This isn’t going to get you information about the health of your storage disks or anything like that. Depending on the disk, it will give you information about things like the physical size, trim status, serial number, RPM (for spinning disks), and things like that.

The tool we’ll be using is smartctl, but that’s installed by installing smartmontools. This is going to be an easy install for many distros and I’ll try to detail that as best as I am able.

smartctl:

The tool we’ll be using is smartctl and it’s a terminal-based application. This tool is useful for a variety of things. We’ll just be gathering basic information about our storage drives. 

If you had smartctl installed already, you could check the man page. Doing so would reveal that the application is described like so:

smartctl – Control and Monitor Utility for SMART Disks

I suppose this could be considered controlling the drives (they’re not all disks anymore) but it’s definitely the tool for the job. Trust me on this! I wouldn’t steer you wrong, at least not intentionally. Oh, I do make mistakes, but they’re mostly harmless.

We’ve previously used this tool. Here’s a couple of articles for you:

How To: Check A Disk For Errors
How To: Use S.M.A.R.T. To Check Disk Health

So, in the weirdness of weirdness, if you want to use smartctl, you have to first install smartmontools. So, let’s cover that…

smartmontools:

First, you’re going to need to install smartmontools. We’ll cover how to do this, but it will be done via the terminal. You can use your GUI installer or you can (more often than not) just press CTRL + ALT + T and your default terminal will open.

With your terminal now open, pick the correct command to match your distro:

Debian/Ubuntu/etc:

OpenSUSE/SUSE/etc:

RHEL/CentOS/etc:

Arch/Manjaro/etc:

If you use a mainstream distro, one of the above commands should install smartmontools and give you access to smartctl. There are other distros out there, but I think I’ve covered those appropriately.

Find Storage Information In Linux:

From here on out, the rest is pretty easy. With smartmontools installed, you can check the man page with this command:

The flag we’re interested in would be the -i flag.

Before we go any further, we must first identify the disks we want to learn more about. For that, we’ll run the following command: 

Here’s an example output:

We’re not interested in partitions. We’re just interested in physical disks. (Now that I’m this far through the article, I should have stuck with ‘drives’ instead of disks.) 

If you pay attention to the output, you’ll see that the information we’re after is stuff like sda, sdb, or sdc. Those are all in the /dev/ directory which means that we can check storage disk information with this syntax:

Or, to provide an example…

This is a pretty good way to gather storage disk information. Here’s an example of the output from the previous command:

See? All sorts of information is available behind a simple terminal command! This is even something you can memorize in just a few minutes.

Closure:

I’m not sure when you’ll want to know this information, but it’s information and it is information that’s easily available to you. You simply need to install an application and run the commands listed above. I’m sure you can figure this out. 

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.

Short: Fix Typos With A Caret

Today’s article is labeled ‘short’ for a reason, and that reason is that we’re just going to cover how you fix typos with a caret. If you’ve ever made typos in a terminal command, you might be interested in fixing typos with a caret. 

This is labeled ‘Short’ for a reason. I’m trying something new. It will be an intentionally brief article. If there’s any benefit to this, I’ll do more short articles in the future.

If you don’t know, the ^ character is a caret.

If you don’t know, you can fix typos with a caret. It’s not difficult and every single one of us has made typographical errors in a terminal command. That means each and every one of us can benefit from fixing typos with the caret character.

You might also be interested in:

Fix Terminal Command Mistakes

It’s really simple to fix typos with a caret. You’ll see…

Fix Typos With A caret:

This article requires an open terminal. Just press CTRL + ALT + T to open your default terminal emulator.

The syntax is as follows:

That doesn’t make much sense, I’m sure. Let me show you an example. We’ll use the ‘uptime’ command.

Let’s say you made a typo and instead of ‘uptime’ you entered:

This will, of course, throw an error. 

You can use the caret character to fix this. For example:

The output from those commands would look like this:

As you can see, you’re replacing uplime with uptime and using the caret character to do so. This is pretty simple and a great way to save typing time when you make a typo in the terminal – especially if it’s a long command.

It doesn’t need to be the first word or anything like that. Let’s make an example out of the following command:

This is, of course, going to throw an error. So, enter the following:

That will re-run the previous command but will substitute the changed text for the matching text in the erroneous command. It doesn’t matter where the typo is in the previous command. It can be anywhere within the command and doesn’t need to be the first word or anything like that.

Closure:

So, this is a short article. Indeed, it’s called a ‘short’ in the title. If it does well, we may see more of them. If it doesn’t do well, you can expect them to disappear without much of a wrinkle in time. They may catch on. I don’t know. I don’t dare speculate, so your opinions really matter in this case.

I do welcome your opinions on the matter. I also don’t mind typing short articles now and then. As far as I can tell, writing an article takes me about the same amount of time, regardless. So, do let me know your thoughts on the matter. Without you, the reader, this site is pretty pointless. Thus, your thoughts on the matter are of interest to me.

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.

The Differences Between APT and APT-GET.

Today will be a brief essay-type of article where we simply discuss the differences between APT and APT-GET. This article is really only useful to you if you use a distro that supports this. Those would be distros in the Debian family, so distros like Ubuntu or Linux Mint.

This will be a brief article and an article where I cheated. I let AI write most of this for me. It seemed like a good task for ChatGPT. So, it was largely written by an ML (Machine Learning) model.

If you’re interested in this sort of thing, read on! Who knows, if it takes off I’ll do more of these types of articles. They don’t save much time because I still need to format the output and crafting the input can be a bit tricky.

Ah well… It’s still fun and informative!

The Differences Between APT and APT-GET:

Debian’s package management system has evolved over time, and two widely used tools for managing packages and software updates are apt-get and apt. Both tools serve similar purposes, but they differ in terms of user experience, functionality, and underlying technology.

apt-get was the traditional command-line tool used in Debian-based systems to handle package management tasks. It has been a reliable workhorse for system administrators and users alike. However, it had some limitations and lacked certain user-friendly features.

apt, on the other hand, stands for “Advanced Package Tool” and was introduced as a more user-friendly alternative to apt-get. It was designed to provide a more intuitive and streamlined user experience while retaining all the functionalities of apt-get.

One of the key differences between apt-get and apt is the command structure and user interface. apt-get commands are generally longer and less intuitive, while apt commands are more concise and easier to remember. For example, to install a package using apt-get, you might use:

Whereas with apt, the command becomes simpler:

Both commands perform the same function of installing the specified package, but apt provides a more user-friendly syntax.

More Differences:

Another notable difference is that apt has a more modern and user-friendly progress bar during package downloads and installations. It offers clearer and more informative output, making it easier for users to track the progress of their package operations.

Additionally, apt supports various new features and functionalities that were not present in apt-get. For instance, apt includes the apt autoremove command, which helps in removing unnecessary dependencies that were automatically installed but are no longer needed. This feature simplifies package management and helps keep the system clean by removing residual dependencies.

Furthermore, apt also integrates the functionality of other apt-get commands like apt-cache and apt-config, providing a more unified and cohesive package management experience. Users can perform tasks like searching for packages, checking their metadata, and managing configurations more efficiently within a single tool (apt).

Despite these differences, both apt-get and apt use the same underlying package management libraries and repositories. They share a common package database and can perform all the essential package management tasks such as installing, updating, upgrading, and removing packages.

In summary, apt is an evolution of apt-get, offering a more user-friendly interface, improved output readability, and additional functionalities while utilizing the same package management backend. Users transitioning from apt-get to apt will find the latter more intuitive and efficient, but both commands remain viable options for managing packages on Debian-based systems.

Closure:

Well, AI did a pretty good job of this. If you wanted to know the differences between apt and apt-get, now you do! You can decide for yourself which you prefer. As you’ve seen throughout these many articles, I default to apt. 

I also wrote this article with AI because I have a storm coming. I want to get this scheduled ahead of time. My brain only works for so long and I run out of ideas to write about. I flip through my notes and they look like articles I want to write, but I can’t figure out what to write about.

Basically, I only have so much creative energy and these articles consume that energy pretty quickly. Sometimes, I have spurts of creative energy and can write a few articles ahead, but that’s not something I can count on. Articles are generally written the night before they’re published. By then, I’ll have enough creative energy again.

I needed to do this the same day that I published an article because Mother Nature doesn’t care about my publication schedule. I’ve had a few years without major outages. It seems like that’s going to be different this year. I suppose I can be grateful for those times when I had no major outages. I’ll be warm, secure, and have electricity – I just may not have internet.

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.

Remove Files By Extension

This should be a quick and easy article, easy enough for anyone to follow, as it covers how you can remove files by extension in Linux. There are a few tips and tricks you can use for this and we’ll be managing files in the Linux terminal. Read on to learn more!

As an aside, I’m thinking about doing some ‘shorts’, which would be short articles that cover a simple topic and do so concisely. If you have any thoughts on this, feel free to opine in a comment.

While Linux doesn’t necessarily care about file extensions, you’ll still often have file extensions. They’re useful for the user, as a way to visually determine a file’s usage quickly. If you see a .sh file, you can guess that it’s a script. When you see a .deb file, you can be reasonably sure it’s a package. You can assume a .png file is an image file.

Today, we’ll be using the ‘rm’ command and wildcards. We’ll be learning how to remove files by extension in the terminal. So, be prepared for that.

The ‘rm’ Command:

You won’t need to install anything for this article. You certainly won’t need to install the rm package. The rm package is a part of the core utilities. You can confirm that rm is available by entering rm --version in the terminal. (I do wish that was consistent, but it is not.)

If you don’t know, you can check the man page, to see the rm command is described like so:

rm – remove files or directories

As the goal is to remove files by extension, this seems like it’d be a good tool for the job at hand. Sure enough, it is!

Remove Files By Extension In Linux:

If you read the intro, and so few of you do, you’d know that we’re going to remove files by extension in Linux – with the terminal. So, open a terminal. More often than not, you can just press CTRL + ALT + T and your default terminal should open.

With your terminal open, the syntax is as follows:

Let’s use .deb as an example. If you want to remove all the .deb files in the folder you’re in, try this command:

The wildcard (the asterisk) means any characters can be there. You’ll remove foo.deb and bar.deb with the above command.

While that’s all there is to it, you can use wildcards for other things.

You can use a wildcard to match other patterns. If you had fle_1_foo and file_2_foo, you could remove them with this command:

If you had file_foo_1 and file_foo_2, you could remove them all with this command:

Pretty sweet, huh?

There’s more to the rm command. If you wanted to do this with folders, you’ll find that rm doesn’t do that by default. So, just add the -r flag to your command, like so:

If you’re having issues removing something with the rm command, there’s a flag you can use to force it. That flag is the -f flag and it’s used something like this:

I guess this article is more about the wildcard than it is about learning how to remove a file by extension. That’s just one way to introduce people to the concept, now that I look at it this way.

The wildcard is a pretty powerful tool in Linux, a tool that’s very useful in the terminal and while doing advanced file management. Knowing how (and when) to use a wildcard will do you well. If you have any questions, you can always ask and I’ll see if I have an answer.

Closure:

So, we’ve covered how to use a wildcard to remove a file by extension. You can do this with folders and other files, not just by extension. What you’d be doing would be pattern recognition and Linux is more than happy to help you along the way. It’s a pretty powerful tool and a tool that every Linux user should be familiar with.

Hmm… I guess 700+ words is short these days. Ah well…

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.

Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.