CentOS Linux: Find Memory (RAM) Usage Information Command

I am a new CentOS Linux user. How do I find out installed ram information on CentOS Linux? How do I find out memory usage statistics on Centos Linux version 5.x/6.x+ using console based command line option?

You can use the following commands on CentOS to find memory usage info:
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 5m
  1. free command
  2. top or htop command
  3. vmstat command
  4. dmidecode command
  5. /proc/meminfo file

Centos memory usage free command

You need to use the free command to see total amount of free and used physical and swap memory in the server, as well as the buffers used by the CentOS Linux kernel. The basic syntax is as follows:
# free
# free [options] # free -m
# free -k
# free -t
# free -l
# free -o
# free -s 2
# free -g

Sample outputs showing total 12GB ram from my server:

             total       used       free     shared    buffers     cached
Mem:            11         11          0          0          0          8
-/+ buffers/cache:          2          9
Swap:            5          0          5

The free command line options are as follows:

  -b,-k,-m,-g show output in bytes, KB, MB, or GB
  -l show detailed low and high memory statistics
  -o use old format (no -/+buffers/cache line)
  -t display total for RAM + swap
  -s update every [delay] seconds
  -c update [count] times
  -V display version information and exit

A better tool is top or htop command (see how to install htop command on RHEL/CentOS):
# top
# htop
Sample outputs:

Fig.01: htop command in action

You can grab the same info from /proc/meminfo file using the following cat command:
$ cat /proc/meminfo

vmstat command

Type the vmstat command as follows:
# vmstat
# vmstat -s

Sample outputs:

     12195116  total memory
     12015316  used memory
      5579508  active memory
      5588540  inactive memory
       179800  free memory
       375484  buffer memory
      9316920  swap cache
      6291448  total swap
       123148  used swap
      6168300  free swap
      9153213 non-nice user cpu ticks
         2353 nice user cpu ticks
      3327358 system cpu ticks
    829062384 idle cpu ticks
       325448 IO-wait cpu ticks
         9047 IRQ cpu ticks
      1070159 softirq cpu ticks
            0 stolen cpu ticks
      4993388 pages paged in
   1012906825 pages paged out
        28376 pages swapped in
        53969 pages swapped out
   2338886238 interrupts
   1688714597 CPU context switches
   1387092323 boot time
       245692 forks

Related media

This tutorial is also available in a quick video format:

Video 01: 5 Linux Commands: To See Amount Of Free and Used Memory

CentOS Linux see installed ram size and other memory info

Use the dmidecode command for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system’s hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision:
# dmidecode --type memory

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 0 comments... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum