Tips

Let’s Have A Look At The free Command

If the title wasn’t enough, today’s article has us taking a look at the free command. Once again, this will be a nice and easy article. I wanted to write a witty title, but Google doesn’t like witty titles for stuff like this and Google has been mad at me for a couple of months! Either way, it’s a good time for an easy article.

If  you’ve somehow never used the free command, you’re in luck! That’s what this article is going to be about! It should be relatively short, as there’s really only a few ways you’ll want to use the command.

What is the free command? Well, it’s an application that you run in the terminal (like oh so many of my articles) and it gives you some needed information about memory usage. It’s not fine-grained information, it’s about total usage. 

You can get this information all sorts of ways. Both top and htop will happily spit this information out. There are any number of GUI ways to get this information, such as your task and process manager may have a tab to tell you about memory usage. 

Us? No, we’ll be using the free command. The man page happily describes the free command as:

free – Display amount of free and used memory in the system

See? It’s another one of those terminal applications that does exactly what it says it’s going to do! Imagine that!

The Free Command:

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.

You can just run the command with nothing else:

free

That’s the same as you’d get if you ran free -w, by the way.

You can pick the display units as flags. Just look into man free to learn how to do that, but the easiest output for most people to read will be to display the units in megabytes or in ‘human readable’ form. You do those with:

free -m

Or the human-readable format:

free -h

Or if you prefer base ten:

free --human --si

Next, as you can see there’s a swap and regular memory section. If you have swap enabled, you can get some small benefit from seeing the total memory used. To do that, try this:

free -t

Finally, you can run the command periodically and get a running output so that you can monitor memory usage over time. That one’s pretty simple. The -s means seconds, so the following will refresh every ten seconds:

free -s 10

There’s more that can be done with the free command, so be sure to run man free in the terminal. However, those are the most common ways I use the command, so it’s likely to be fairly similar usage needs for you.

Closure:

There you have it, we have an article about the free command. It’s a good way to monitor memory usage, unless you need something more fine grained. If you want, there are are tools for that – including top and htop. But, those are fine article ideas for another time.

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

Short: The Halt Command

Today's article is intentionally short because we're simply going to learn about the basics of…

6 hours ago

Installing Flatpaks In Linux

Today we're going to have a pretty easy article where you'll learn about installing Flatpaks…

2 days ago

A Quick Look At The Shutdown Command

This is going to be just a quick article about a command many of you…

4 days ago

Setting Up Coding Environments on Linux for Educational Use

With so many strong attributes, such as robustness and flexibility, Linux stands as a powerful…

6 days ago

View Detailed Hardware Information

There are many tools for showing your hardware information and today we'll get to view…

1 week ago

How To: Install Wine In Lubuntu

Today's article isn't going to be complicated or long as we are going to cover…

1 week ago