How To: Clear Swap

Today’s article is just going to be a quick and easy article, where we learn how to clear swap. I figured I’d do this article while swap was still fresh in my memory so that I’d not forget to write it down the road. If you use swap and want to learn how to clear swap, read on!

Again, this article is only useful for those that use a swap. There are different opinions about using swap and this article is for those who do. I just wrote an article about how to monitor swap, so we might as well learn to clear it.

What do I mean by clearing swap? I mean emptying it. I mean removing all the data held in swap, allowing for data to be written to swap again. It’s not something I worry about, but I know folks have asked about it in the past. I might just as well cover it, though it really won’t take much time.

Clear Swap:

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 now open, you can clear swap with the following command, by turning swap off:

You then turn swap back on with:

Tada! You’re all done. If you want, you can do it all with just a one-liner:

That’s really all there is to it. It’s not terribly complicated and it’s something you might as well know if you’re going to use swap and are concerned with monitoring and clearing it.

Closure:

There you have it. I told you that it’d be short and easy. You now know how to clear swap, should you actually want to do so. You might as well know how. It’s bound to come in handy for someone.

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.

A Couple Of Ways To Monitor Swap Usage

Today’s article will be nice and easy, as we cover just a couple of ways to monitor swap usage. There are several ways to monitor swap usage, so we’ll just cover a couple of them. One of ’em is bound to work.

So, this only applies to those people who use swap. If you use the search feature, you’ll see that I’ve addressed this before and that I tend to use swap – because it’s more than just a place the kernel sticks stuff when you’ve run out of RAM.

swap is still used with plenty of RAM
See? The system happily uses swap with plenty of free rams.

As you can see, on a system with plenty of RAM – and plenty of free RAM – the system still uses swap. I figure that the kernel is smarter than I am. You do you, but I will continue using swap.

But, enough about that. If you don’t use swap, just accept that this article isn’t meant for you and move along. Tomorrow’s article might just have something useful for you. You never know!

So then, I will assume readers know enough about what swap is and will have made their own choices. This article is for those who want to monitor swap usage.

Let’s Monitor Swap Usage:

You guessed it. You’re going to need an open terminal. So, open your favorite terminal emulator. 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 try the following command:

(You can just use ‘free‘ but the -m flag makes it easier to read. You can also use ‘free -h‘ if you prefer that output.)

That command should be fairly universal. You can also use the following command if you’d prefer. It’s just:

That command is pretty handy and pretty much is the same as you’d get if you just run’cat /proc/swaps‘ which is, I suppose, yet another way for you to monitor swap usage. Think of it as a bonus way to check swap usage. After all, you can’t have too many ways and one of ’em is bound to stick with you if you use it often enough.

Closure:

And there you have it. You have another article. This time, we’ve discussed how to monitor swap usage (in the terminal, of course). It’s a handy tool for those who do use swap (be it partition or swapfile). If you don’t use swap, you probably won’t get much use from this article. Maybe tomorrow will be more interesting for you?

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.

NEWS: List Your LUG At A New LUG Repository

Today’s article is just going to be a brief new article where I share the news of a new LUG repository. It’s an effort to provide a centralized location for those looking to find or promote a LUG. Read on, to learn about a new LUG Repository.

What is a LUG?

A ‘LUG’ is a Linux User Group. You’ll sometimes see folks call them a GLUG, which would be a GNU/Linux User Group. A LUG is a group of Linux users that have formed an organization, often a loosely organized group, to help and inform people interested in the GNU/Linux operating system.

Though they’re not as popular as they once were, there are still many of them, though the pandemic appears to have slowed some down. They still exist and there’s no real central repository – until now.

By the way, local user groups existed long before Linux was around. The PC market was largely prompted by people who participated in groups like that, as OEMs came to realize that the niche could be profitable. Today, you’ll find people still meeting in person, meeting online, or meeting both online and in person.

The Solution:

The admin, @Rob, saw the problem – that there’s no centralized place for people to find their nearest LUG. You can use your favorite search engine and hope for the best, but finding a good repository of LUG information wasn’t realistic – and those that do exist are often woefully out of date and appear to be unmaintained. 

Because of this, the Linux.org site now has a way for you to add (or convince your LUG leaders to add) your LUG to a repository that will hopefully become a great asset for LUG-organizers and those searching for their local LUG.

If you are an organizer or can ‘speak for’ your LUG, you can add your LUG to the repository here:

Linux.org LUG Repository

To avoid abuse/spam, you will need to register to manage your LUG. Once registered, you can then manage your LUG’s information after listing it. 

The goal here isn’t to control anything but to provide a service that was otherwise lacking. So, there are no costs associated with adding your LUG to the repository. 

Disclosure:

I am ‘KGIII’ on Linux.org and am a moderator of the forum. All attempts have been made to remove any potential biases.

Closure:

There you go. There’s a bit of news. Some of my readers will come from Linux.org already, so they should already know this. However, a bunch come from elsewhere, far more than come from Linux.org, so this is aimed at those users – especially if they want to add their LUG to the LUG repository.

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.

How To: Install Proprietary Drivers In Ubuntu

Today is going to be a very quick and easy article, where we learn how to install proprietary drivers in Ubuntu – in the terminal, of course. It’s easy enough for a new user, as it’s just a single command. It’s also not all that well known and not documented in the man pages or anything, so I might as well cover it here.

There are all sorts of reasons why you might want to install proprietary drivers in Ubuntu. Some of your hardware may not work at all until you do. Some of your hardware will only have partial functionality until you do install the proprietary drivers.

Of course, if everything is working just fine, you might not even need to worry about the proprietary drivers in Ubuntu. If everything is fine, there’s no reason to worry too much. You know what they say, “If it ain’t broke, don’t fix it.” 

Of course, a subset of you will say, “If it ain’t broke, tweak it!”

Anyhow, this article only applies to Ubuntu and official Ubuntu flavors. It likely also applies to Ubuntu derivatives. A quick check seems to indicate that Mint is one of those derivatives that support this command. We’ll only cover it from the Ubuntu-specific direction. If it also works for you, that’s a benefit. If it doesn’t work for your distro, the maintainers likely took it out for a reason.

So then, let’s get to work installing proprietary drivers on Ubuntu…

How To Install Proprietary Drivers In Ubuntu:

As mentioned above, we’ll be doing this in the terminal. So, you’re going to need an open terminal for this exercise. You can just press CTRL + ALT + T and your default terminal should open.

With the terminal now open, we need to ensure you have the “Restricted” repository enabled. As you already have a terminal open, we might as well do that while in the terminal. So, type the following command:

Now, you need to update your database of software that’s available and we might as well make sure all other software is up to date. You do that with this command:

There you go. You’re now ready to install proprietary drivers in Ubuntu. So, while it’s a single command, it may require some preparation for some users. If you’ve run the above commands, we should be on the same page. So, with that, you just run the following command:

If there are any prompts, just go ahead and press the Y button. Everything should go smoothly and you may need to reboot after installing the proprietary drivers. When you’ve done that, you should be using the newly installed drivers instead of the open-source (or no) drivers. 

That’s all there is to it…

Closure:

There you have it! You have another article. I know I told you that it was just a single command and then shared more than one command, but it is just one command so long as you’ve got the Restricted repository enabled already (and I think most of us do). Either way, there’s a quick and easy way to install proprietary drivers in Ubuntu, in the terminal even. ‘Snot all that difficult after all!

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.

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.