Array

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

Whirlpool Oven F6E6: Appliance Manager 1 Board Communication

I have a brand new Whirlpool oven W11I OM1 4MS2 H or (859991549450). I bought it alongside the microwave combi oven. I have had...

Whats the difference between the Tapo P100 and the P105?

There are a few different Tapo smart plugs. The P100 and P110 differ based on the smart power monitoring feature but where does the...

Time remaining keeps going up on Whirlpool dryer??

I have clothes in the dryer regularly and the time remaining shows on the display. There could be 10 mins remaining and if I...

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

Bitrate Converter

Below you will find a bitrate converter. This tool will allow you to enter a bitrate value, in one of many different formats and...

Aesthetic Text Generator

There are various ways to make your social media profile seem more unique, some of which are not as easy to implement as others....

Aspect Ratio Calculator For Images

Aspect ratio is the ratio between the height and width of an image. If you want to resize an image by 100 pixels, you...

Add Text To Image

Use this free tool to add text to an image. Simply select the image file that you want to overlay text onto and you...

JavaScript Multi-line String Builder

Javascript did not always support multi-line strings. If you attempted to create a string variable using quotes, putting a line break into the source...

GUID Generator

GUID generation is relatively simple. It is a system that is used to generate unique values without having to keep track of the IDs...

Latest Posts

Latest Questions