How To: Check Disk Usage With ‘df’

In today’s article, we’re going to do exactly what the title suggests; we’re going to check disk usage with ‘df’. This means we’ll be checking disk usage in the terminal. Seeing as ‘df’ is included with every distro on the planet (I’m pretty sure) it means this won’t be all that complicated.

I am still a bit under the weather, but the show must go on! I’ve gone this long without missing a publication date, so I might just as well keep the  streak up. 

As the title suggests, we’ll be using ‘df’ to check disk usage. This will already be installed as one of the default tools, so you won’t need to install it. That’ll save some time! If you’re curious, the ‘df’ tool describes itself as:

df – report file system disk space usage

If you want to get a head start, you can check the help page. To do that, you’ll want to run:

If you’re like to check the version, the command is:

So, with that in mind, let’s just jump into the article.

Check Disk Usage With ‘df’:

Obviously, this is yet another article where we’re learning about doing things in the terminal. That means you’ll need an open terminal. 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.

With your terminal now open, you can just run the command by itself:

In some cases, it will throw an error and not be able to read everything. That’s usually easily resolved. Just run the command as a privileged user. So that would look like:

Now, you can use that output to do a bunch of math, or just pay attention to the percentages. Or, if you’re wanting, you can use the -h flag and get the output in human-readable format. That looks like:

The output of which might look a little something like this:

the output of sudo df -h
See? No errors and it is nice and readable! You can’t go wrong with that!

As you can see in the picture, I’m only using less than half of my available disk space. I don’t need to worry about running out of space any time soon, but if it gets low I can always check disk usage with ‘df’. Also, it doesn’t matter what directory you’re in when you run the command. As you can see, it runs just fine while in the Downloads directory.

I also wrote an article about using GUI methods to visualize disk space usage. You might prefer one of those methods, but you can always just use the terminal to check disk space.

Closure:

It seemed like a good idea to do a quick article tonight. I’m watching IMSA’s last race of the season and feeling poorly, so hopefully I get some sleep at a reasonable hour. Still, as I mentioned, the show must go on. The site has had a new article every other day for quite a while. I might as well keep up the schedule.

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.

Let’s Learn To Remove A Directory

Today’s article is going to teach you how to remove a directory. This being Linux and rmdir, you can only remove empty directories. That’s okay, that’s still what we’re going to use. I’m pretty sure I’ve explained how to remove files before and, if not, that’s a pretty simple task.

This article is going to be light on details and pretty short. I popped positive on one COVID test and negative on another. I could take a third test, but I really just feel crappy and not all that bad. Still, it’s an excuse to have a nice and easy article! I like those sometimes! My proofreading may be sub-par.

Like I said, we’ll be using ‘rmdir’ and that only works on EMPTY directories. I can’t stress this enough! If there’s a file in the directory, any file, it will not delete the directory. 

Umm…

I do not know the design reason for making ‘rmdir’ (a standard tool in every Linux) only remove empty directories – but I suspect it’s a protection method. It’s protecting itself from you – meaning you must go in and confirm that it is empty and that there are no files remaining that you’d like to keep. After that, you can delete the directory.

That stands to reason and, frankly, it’s the only reason I can think of. If anyone knows the real reason, assuming I am wrong, please feel free to let me know in a comment. I’m quite curious. Ah well… Onto the article!

Remove A Directory:

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.

Now, with your terminal open, let’s use ‘rmdir‘ and learn how to remove a directory. In its basic form, the command is:

This works if it’s a path you want to specify:

If you want, you can use the -v switch and get a verbose output, telling you what is being deleted. This is probably for the best. So, it’d look like:

But wait, there’s more! What if you wanted to remove all of that, you want to remove /path /path/to and /path/to/dir? Well, you can do that:

Of course, if you want confirmation of what’s being deleted, try:

Assuming all those directories are empty, the command will complete itself and remove all the directories in that path. Those are basically all the rmdir commands you’re likely to need, but you can check man rmdir for more information.

Closure:

See? Nice and easy. See? You even get an article when I’m dying from the plague! Don’t worry, I’m sure I’ll be just fine. Statistics are my friend at times like this, so my worry level is exactly 0%. The odds of it incapacitating me are negligible and I’m a pretty big fan of math.

I’m vaxxed to the max and even boosted – which only lessens your chance. I’ll be fine. After all, only the good die young! (I am not young, now that I think about it!) I’ll quarantine at home and hope for the best, while monitoring for degradation.

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.

Compress A File With WinRAR

Today’s article is going to teach you how to compress a file with WinRAR. This isn’t exactly something you’re going to do often, unless you share files with Windows users. If you do share files with Windows users, this isn’t such a terrible idea. There are worse ideas, some of which are on this site.

Before you get to excited, there are countless ways to compress a file in Linux. The odds of  you technically needing WinRAR are about zero. Still, that doesn’t mean we can’t have fun and learn new things!

Right?

Right!

It’s great to learn new things, even if you’re never gonna use them. Until about 5 minutes ago, I can’t remember the last time I felt the urge to compress a file with WinRAR. I’ve previously written about WinRAR, actually. 

How To: Extract An .rar File

So, if you follow that link you’ll learn how to perform the other end of this operation! I’d like to pretend I planned it that way, but I did not. No, there’s no rhyme or reason to the publication schedule – except you get a new article every other day.

Compress A File With WinRAR:

Yup. You’re gonna need an open terminal for this one. 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 rar. It’s probably in your default repositories. It’s there for Debian, Ubuntu, and Mint. So, it’s probably available for you. You can get the proprietary version of WinRAR here. (Or not… I don’t see a whole lot of folks wanting that, but it’s there if you do! Also, I think it’s just a trial version.) Or, install it from your repositories. With those operating systems, it’s just:

Now, it’s really easy to compress a file with WinRAR. The command is:

The ‘a’ flag is telling the command to archive the file/folder you named. If you wanted to compress a file (or even a directory) named foo, it’d look like this:

See? That’s all you really needed to know if you want to compress a file with WinRAR. It’s not exactly complicated, but it’s helpful to know how if you come across a situation where you actually need to know. Again, there’s a zillion ways to compress files in Linux, so you’re not going to need this one all that often unless you really need it. If you do use WinRAR with Linux often, please leave a comment explaining why.

Closure:

Yup. It’s another article! This one teaches you how to compress a file with WinRAR. In my defense, this is information that’s from my notes. I have a whole lot of notes, but this one stood out today and so you get this for your article. You’re welcome!

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: Hide The Output From wget

In today’s article you’re going to learn that you actually can hide the output from wget. I am not one of folks want to do this, but some do. Or at least the option is there, so I assume they do. Either way, read on and you’ll know how to hide the output from wget! 

Goodwood Revival is this weekend, but you’ll still get an article. I am thinking about going in person next year, so I’ll have to write articles ahead of time. I probably should have done that even though I’m just streaming it.

Anyhow, there’s an option that will let you hide the output from wget and it’s in my notes. I might as well turn it into an article because I’m sure someone wants to do this. 

What this does, to be clear, is shows no wget output in the terminal once you enter the command. You’re not running blind, however. I’ll show you how to at least ensure the command gets completed. So, it does have uses – when  you just don’t need to see the clutter.

Lots of people do loads of useful work in the terminal and don’t really need to see clutter, so this is one way to avoid that terminal clutter. I actually prefer to see what’s going on, but I’m weird like that. If you do not prefer to see what’s going on with wget, this article is for you!

Hide The Output From wget:

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.

It next requires that you use wget to get something. So, pick something and download it with wget. I don’t care what. You do you and download anything you want. To hide the output from wget, the command is:

That’s really it. However, you then have no idea if it it completed. Fortunately, you can make sure wget completes its task (within reason) with the -c flag. So then the command would look like:

See? Pretty simple. That command will not only hide the output from wget, it will ensure the download is completed. You’ll avoid cluttering up your terminal, or something…

Closure:

There you have it! You now know you can, and how you can, hide the output from wget. You can even be reasonably sure it completes behind the scenes. It’s not a very difficult article to follow today, so consider it an easy day. Now, back to my racing…

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.

How To: Make A File Executable

Today we’re going to learn something important, that is how to make a file executable. This is something everyone should know how to do. It’s not going to be easy to make this into an article, ’cause it’s really quite easy, but I’ll give it a shot.

One of the important things about Linux is that files have various permissions. You can read, write, and execute a file based on the permissions. This helps keep Linux a bit more secure, because files can’t be executed until you’ve given them permission to do so.

I’ll make this article as straightforward as I can, by trying to give you an example of how this works. We’ll create a file, make it executable, and then run said file. This should serve as a good example, so that you can do so in the future.

You’ll see a bunch of commands in this article. If you’re new, just follow ’em until the end and you’ll hopefully understand what’s going on, and see how to make a file executable. Trust me, this isn’t something all that taxing. I’m sure you can get it!

Make A File Executable:

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.

With your terminal open, let’s create a new file. We’ll do that with:

Open love.sh for editing with nano by using the following command:

Enter the following text:

Now, you’ll have to save that. Just press CTRL + X, then Y, and then ENTER. That will save the file with the newly added text.

Now, we’ll make the file executable with the ‘chmod‘ command. That’s done with this command:

With that done, all you need to do now is execute the file. To do that, you just call the file by name in the terminal. As you’re still in the same directory, you’ll need to use ./ – so your command actually looks like:

With that, you should get a message saying that you love Linux Tips. Aww… Isn’t that sweet of you! We love you too! It was also a fun way to create a file, edit it, make it executable, and then actually executed said file.

Closure:

See? That wasn’t all that hard. I hope that method shows you a little about how to make a file executable. It’s a pretty basic skill that all Linux users should be familiar with. It’s not a very complicated article, but that’s just fine. At least we (hopefully) had some fun with it.

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.