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!
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.
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.
Today we'll cover one way to enable or disable your network interface in the Linux…
Today's exercise is a nice and simple exercise where we check your NIC speed in…
Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…
I think I've covered this before with the ls command but this time we'll count…
Today we'll be learning about a basic Linux command that's known as 'uname' and it…
If you've used hardinfo in the past, it may interest you to know that hardinfo…