3 Ways To Check RAM Usage Via Linux Command Line

Here are 3 simple ways to check your systems current RAM usage, when working via command line.

The free command has multiple options. Free on its own will provide you the ram usage in bytes. This is probably useless to most so adding -m after it will give you the value in megabytes.

free -m

The output should be something like this

total used free shared buffers cached

             total       used       free     shared    buffers     cached
Mem:          4096        712       3383        131          0        307
-/+ buffers/cache:        405       3690
Swap:          128          0        128

An alternative is to use top. This will give you the specific applications that are using the memory along with CPU usage. The best thing about this command is it’s in real time. The data is very much like that displayed in task manager for Windows.

top

This should output something like this

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
   1 root      20   0 19364  436  132 S  0.0  0.0   0:01.11 init
   2 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kthreadd/69576
   3 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper/69576
   4 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/69576/0
   5 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/69576/1
   6 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/69576/2
   7 root      20   0     0    0    0 S  0.0  0.0   0:00.00 rpciod/69576/3
   8 root      20   0     0    0    0 S  0.0  0.0   0:00.00 nfsiod/69576
 127 root      16  -4 10652  280    0 S  0.0  0.0   0:00.01 udevd
 499 root      20   0  179m 2256  324 S  0.0  0.1   0:10.23 rsyslogd
 545 named     20   0  307m  26m 1720 S  0.0  0.7   1:24.78 named
 563 root      20   0  4580  148   60 S  0.0  0.0   0:00.06 mdadm
 572 dbus      20   0 21436  236    4 S  0.0  0.0   0:00.00 dbus-daemon
 610 root      20   0 66220  900  192 S  0.0  0.0   0:07.61 sshd
 621 root      20   0 52112  628   88 S  0.0  0.0   0:00.28 vsftpd
 657 root      20   0  105m  304    4 S  0.0  0.0   0:00.05 mysqld_safe
 864 mysql     20   0 1727m 170m 3940 S  0.0  4.2  49:40.23 mysqld

vmstat is another simple way to check RAM usage. This isn’t quite as useful if you want to quicky check. It will display most of what the free command displays along with a few extra details.

vmstat -s

Output

4194304 total memory
728952 used memory
296176 active memory
383972 inactive memory
3465352 free memory
0 buffer memory
314504 swap cache
131072 total swap
0 used swap
131072 free swap
887837 non-nice user cpu ticks
1429 nice user cpu ticks
199846 system cpu ticks
182661931 idle cpu ticks
134832 IO-wait cpu ticks
0 IRQ cpu ticks
0 softirq cpu ticks
0 stolen cpu ticks
13589860 pages paged in
5739148 pages paged out
0 pages swapped in
0 pages swapped out
0 interrupts
46730701 CPU context switches
1423896862 boot time
105029 forks

While on the subject of RAM the following commands will give you the technical information about the RAM that is installed on the system you are working on. dmidecode will get you the max capacity, number of devices and some other basic information.

dmidecode -t 16
dmidecode -t 17

Related Articles

Related Questions

Looking for Advice on Developing an AI Music App

I have a cool idea for an AI-powered music app, but I have no background in software, tech, or coding. I'd really appreciate it...

Why is my boot SSD showing so many writes in just 5 months?

I've recently noticed that my boot SSD has logged over 3TB of data written in just five months, which seems excessive. I've only saved...

Best Way to Generate a PDF Download Button for My Website?

I'm working on a website with my friend who's in charge of the front-end using React, while I handle the back-end with ASP.NET Core....

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Tools

Scavenger Hunt Team Randomizer

Planning a scavenger hunt and need to split participants into random teams? Whether you're organizing a school activity, a corporate team-building event, or a...

File Hash Generator Online – Get Instant MD5 and SHA-256 Hashes

Whether you are validating downloads, checking for corruption, or comparing files for duplicates, having a fast and secure way to generate file hashes is...

Visual CSS Editor for Modern Glass UI Effects

Modern UI design is all about clean, layered aesthetics, and few styles deliver this better than glassmorphism. If you're designing sleek user interfaces and...

Fast and Accurate Tap BPM Counter – Free Web Tool

Whether you're producing music, DJing live, or just figuring out the tempo of a song, knowing the BPM (beats per minute) can be critical....

Glassmorphism CSS Generator with Live Preview

Glassmorphism is one of the most visually striking design trends in modern UI. Its soft, frosted-glass effect adds depth and elegance to web interfaces,...

Add Custom Speech and Caption Boxes to Any Image Online

Creating comic-style images used to require complex design tools or specialist software. Whether you're making memes, teaching graphics, social media posts or lighthearted content,...

Latest Posts

Latest Questions