Today’s article is all about how you can check your memory in the terminal. If it looks familiar, it’s because I’ve already written “How To: Find The RAM Total In The Terminal“, which covered a couple of ways to check your RAM – all of which were in the terminal. I left the article open for others to share how they check their memory, but nobody left any comments.
In the previous article, I invited people to comment and share other ways to check RAM, RAM total, RAM usage, etc… Seeing as nobody commented, I figured I might as well return to the previous article and throw in a couple more ways to do check your memory in the terminal.
The previous article includes some handy tools, such as the easiest way:
free -m
While also mentioning a much more extensive and informative tool:
cat /proc/meminfo
Both of which are lovely ways to check your memory in the terminal.
This being Linux, there’s also other ways.
Me being me, I figure I might as well share them with you.
After all, it’s yet another article that I can write! So, as unoriginal as this article may sound, there’s also a couple of tools I really want to introduce you to.
There’s always room for more tools, especially if they’ll help you…
As the line above indicates, you’re going to need an open terminal to do the work in this article. You can open it from your start menu, or you can just press CTRL + ALT + T and your default terminal should open right up.
The first tool we’re going to use is ‘top‘. I think you’ll find top installed on pretty much everything, though some distros are including variants like htop. The venerable top application is a terminal-based task manager and has been with us since 1984.
Anyhow, the command is nice and simple. Just run ‘top’ in the terminal:
top
The output will look something like this:
The last two lines of data, above the list of tasks, tell you all you need to know (unless you need a ton of details, I suppose) about your RAM, your RAM usage, what’s buffered, etc… It also tells you about swap, another facet of memory.
Next we have a lovely command called ‘vmstat‘ a tool for showing virtual memory statistics. This lovely tool has been around since 1985 and has a ton of options. It’s an excellent tool and you’re highly encouraged to use the man vmstat
command.
We actually don’t need all those lovely options for this. We don’t have to dig down very far to get the information you need. In fact, once again, you’re going to run the command without a single flag, like so:
vmstat
The outcome of which is also self-explanatory. It looks like:
Just look under where it’s clearly marked ‘memory’ and you’ll see that you can use this to check your memory. It’s a bit more cryptic as it doesn’t directly show the total – but it does show you the information that’s actually important.
The total doesn’t matter. What really matters is how much RAM you’re using and how much RAM you have free. But, vmstat being vmstat, it will of course give you that information if you want it. If you do want that additional information, just use the --stats
flag – like this:
vmstat --stats
Where you can see an output similar to this;
Pretty sweet, huh?
There you have it, a follow-up article that tells you how to check your memory. After all, nobody wanted to add them as comments! Either way, you got to play with a couple of new tools, or at least tools not really mentioned here on this site.
Speaking of the site, the end of my year long project is in less than 2 months. That’s right, I’ve kept this up for this entire time, with a few guest articles in between. I’ll do a meta article, but I have to say that this has been a pretty fun (and educational) project. Maybe we’ll keep it rolling? It seems likely that I will. I quite like writing these things.
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…