Linux Check Memory Usage Using the CLI and GUI

How do I check used and free RAM memory usage under Linux operating systems using command line and GUI tools?

Linux comes with different set of commands to check memory usage. The free command displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The vmstat command reports information about processes, memory, paging, block IO, traps, and cpu activity. Finally, you can use the top or atop/htop commands which provides a dynamic real-time view of a running system. top and friends can display system summary information as well as a list of tasks currently being managed by the Linux kernel. Let us see various commands for Linux to check memory usage.
Tutorial details
Difficulty level Easy
Root privileges Yes/NO
Requirements Linux/free command
Est. reading time N/A

Linux check memory usage using /proc/meminfo file

The /proc/meminfo file stores statistics about memory usage on the Linux based system. The same file is used by free and other utilities to report the amount of free and used memory (both physical and swap) on the system as well as the shared memory and buffers used by the kernel.


Use the cat command or grep command to see /proc/meminfo file:
$ cat /proc/meminfo
$ less /proc/meminfo
$ more /proc/meminfo
$ egrep --color 'Mem|Cache|Swap' /proc/meminfo

MemTotal:        8120568 kB
MemFree:         2298932 kB
Cached:          1907240 kB
SwapCached:            0 kB
SwapTotal:      15859708 kB
SwapFree:       15859708 kB

free command

To display free memory size in MB (megabytes):
$ free -m

             total       used       free     shared    buffers     cached
Mem:           750        625        125          0         35        335
-/+ buffers/cache:        254        496
Swap:          956          0        956

Displays a line containing the totals memory in MB:
$ free -t -m

              total        used        free      shared  buff/cache   available
Mem:          31731        6905       13427         903       11398       23479
Swap:        122067           0      122067
Total:       153799        6905      135495

Understanding the free command outputs

The Mem columns contain the following information:

  1. Total : The total amount of RAM installed in my system. In this case 30Gi.
  2. Used : The total amount of RAM used. It is calculated as: Total – (free + buffers + cache)
  3. Free : The amount of unused or free memory for your apps.
  4. Shared : Amount of memory mostly used by the tmpfs file systems. In other words, Shmem in /proc/meminfo.
  5. Buff/cache : It is sum of buffers and cach. Buff is amount of memory used by Linux kernel for buffers. Cache is memory used by the page cache and slabs.
  6. Available : This is an estimation of how much memory is available for starting new applications on Linux system, without swapping.

The Swap columns contain the following information:

  1. Total : The total amount of the swap partition or file installed in my system. For example, 119Gi is the size of my swap space on Linux.
  2. Used : The total amount of swap sapced used.
  3. Free : The amount of unused or free swap space for Linux systems.

So how much free ram I have?

Type the following command:
$ free -m

Understanding Free Command Output

In this above output, my server has used 2825 MB ram, and 9083 MB is available for other users and programs.

A list of free command options

  • -h : Human readable output. In other words, show all output fields automatically scaled to shortest three digit unit and display the units of print out. For example, B used for bytes, Ki means kibibyte, Mi is mebibyte, Gi is gibibyte, Ti means tebibyte, and Pi for pebibyte.
  • -b,-k,-m,-g: display output in bytes, KB, MB, or GB.
  • -l : show detailed low and high memory statistics.
  • -o : use old format (no -/+buffers/cache line).
  • -t : see total for RAM + swap usage on Linux.
  • -s : update every [delay] seconds.
  • -c : update [count] times.

vmstat command

Type the vmstat command at shell prompt:
$ vmstat

procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
1  0      0 131620  35432 341496    0    0    42    82  737  1364 15  3 81  1

top command

Type top command at the shell prompt:
$ top

Fig.01: top command displaying used memory

To exit from top command type q key.

atop command

The program atop is an interactive monitor to view the load on a Linux system. This program can display the amount of used and free memory. It is similar to top command but comes with additional advanced options. By default, the atop command is not installed on most Linux distributions.
$ atop

Fig.02: Linux Check Amount Of Memory With atop Command (click to enlarge)

htop command

The program htop is an interactive process viewer. It is similar to top, but allows to scroll the list vertically and horizontally to see all processes and their full command lines.
By default, the htop command is not installed on most Linux distributions.
$ htop

Fig.03: Linux Check Amount Of Physical Memory With htop Command (click to enlarge)

GNOME Desktop: GUI tool to see memory usage

The “Gnome System Monitor” application enables you to display basic system information and monitor system processes, usage of system resources, and file systems. You can also use System Monitor to modify the behavior of your system. You can start System Monitor by visiting System menu > Choose Administration > System Monitor option. Or type the following command at the shell prompt:
$ gnome-system-monitor

Fig.04: Linux See Memory Usage With GNOME GUI System Monitor Tool

Check out related media

(Video 01: Top five commands to see used and free memory under Linux)

A note about the performance

  1. RAM – An occupation percentage of 90% is considered as critical.
  2. SWAP – An occupation percentage of 80% is considered as critical.
  3. To solve performance related problems, add more RAM and increase the swap space (or move swap space to another disk controller).


In this quick tutorial, you learned about various Linux commands that you can use to check the server or desk memory usage. Read man pages of free, vmstat, top, atop, and htop commands for more information by typing the following man command:
$ man free
$ man top
$ man vmstat

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

🐧 80 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
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 glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep 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
80 comments… add one
  • suresh Sep 12, 2007 @ 8:12

    Hi ,

    I need a unix command to get the total memory usage that i can call this command from java.The output of the command should only be the percentage of memory utilization.


  • Matt Nov 30, 2007 @ 16:01


    ps aux | awk ‘{sum +=$4}; END {print sum}’


  • Michael Dec 6, 2007 @ 16:00

    Using the command free, vmstat, top all shows it uses almost 100% of the memory. But if I use the system monitor, it will show only less than 10%.

    I am using CentOS 5. can anyone explain why the free, vmstat, top all displaying wrong information? Thanks.

    $ free -m
    total used free shared buffers cached
    Mem: 3792 3638 154 0 128 3231
    -/+ buffers/cache: 277 3515
    Swap: 1983 0 1983
    $ vmstat
    procs ———–memory———- —swap– —–io—- –system– —–cpu——
    r b swpd free buff cache si so bi bo in cs us sy id wa st
    0 0 108 158380 131948 3309388 0 0 106 75 203 180 0 0 98 1 0

    • Selan Oct 6, 2011 @ 1:12

      Cached memory is a kind of free memory.

  • Atahan Feb 1, 2008 @ 7:30

    Actualy memory is not used by application, but it is used for disk caching.
    If memory is not fully utilized by kernel than it is wasted, by keeping data in cache when an application needs data again it can be provided faster.
    If you want to see the memory from the perspective of application you should look at +- buffers/cache line, the free column of this line shows you the memory that can be used for applications.

    In the case below my application using 2GB of memory.

    # free -m
    total used free shared buffers cached
    Mem: 7973 7323 650 0 128 5152
    -/+ buffers/cache: 2042 5931
    Swap: 8189 40 8149

    • Ganesh Mar 9, 2011 @ 20:56

      Thank you.

  • Ohm May 20, 2008 @ 4:15

    Hi ,

    I take care 2000 PCs that using Redhat 7.3. I’m finding the command to create script file to check RAMBus of the PCs. Could you please help to recommend the appropriate one ?



  • pudhiyavan Jun 19, 2008 @ 18:49

    is there any way/script to find out physcial memory usage exclusive of buffer/cache usage??

  • don Aug 6, 2008 @ 9:28

    very good

  • Shaukat Ali Gill Nov 9, 2008 @ 13:58

    You can also check memroy by using command “cat /proc/meminfo” it will give you detail info.

  • Duncan Dec 5, 2008 @ 20:23

    the memory information is also stored in /proc/meminfo… so just in case you don’t have any tools installed… cat /proc/meminfo

    • mouli Aug 25, 2011 @ 5:27

      i am expecting a command to see memory information. you said cat /proc/meminfo ,it is for seeing the configuration file right… is there any possibility to get the details of memory directly..

      • 🐧 Vivek Gite Oct 31, 2016 @ 6:44

        Yes. All other tools read info from /proc/meminfo.

  • amm Jan 10, 2009 @ 13:03

    hi all

    I use sun servers and solaris os and memory load has been increased to 90%

    I need to know which command can i use to check on its memory and how i know the abnormal increase

    • banu Oct 31, 2016 @ 5:02

      Did you get the answer amm? I am also seeking answer for the same question? If you got the answer please mail me.

  • kshard Jan 22, 2009 @ 13:06

    hi all

    I am trying to get the output of the command top in java using a processbuilder. But its not giving any output. Though a command such as ‘ps -all’ is giving the required output. Can anyone help please. Its urgent…


  • team fortress Jan 23, 2009 @ 22:05

    How can I find the memory used by each php script on the server?

  • kishore Feb 21, 2009 @ 10:55

    hi this is kishore

    with single command can we get information of version of linux , ram,and memory status informationa. And as well as with single command the total system information
    can i know the comman of linux


  • Oink! Mar 30, 2009 @ 7:51

    [kishore] You need to write a script which excutes various commands and output as a single command.

  • Psycho Tux Apr 30, 2009 @ 9:01

    ps aux | awk ‘{sum +=$4}; END {print sum}’. It works.
    Thanks Matt…
    Is there any way to do the same for SWAP also.

  • Ajay Kumar Bysani Jun 15, 2009 @ 6:36

    How can get the average memory usage of a perl script that I am running on a linux machine? Can anybody help?

  • T Sudhakarraj Aug 13, 2009 @ 4:22

    Hi kishore

    Use this coomand to get all the required information

    lsb_release -a && free -m

  • Paul Plowman Sep 3, 2009 @ 16:54

    Believe that we have a memory leak on RHEL 4.5 with Java & Apache running.

    ps -eo pid,ppid,rss,size,vsize,sz,pmem,comm | awk '{ rss += $3; size += $4; vsize += $5; sz += $6; pmem += $7} ; END { print "rss = "rss" size = "size" vsize = "vsize" sz = "sz" pmem = "pmem }' ; free -m
    rss = 4590060 size = 7302928 vsize = 11360544 pmem = 26.7
    total used free shared buffers cached
    Mem: 16028 15979 48 0 0 24
    -/+ buffers/cache: 15954 73
    Swap: 32767 4571 28196

    Does anyone have a command, code, or program to identify where the memory is being utilized?
    After a reboot the server is using 24.6% of memory or free shows 4869 MiB.


  • T Sudhakarraj Sep 4, 2009 @ 7:13

    Hi Paul,

    ps -auxf | sort -nr -k 4 | head -10

    The above mentioned command will display top 10 memory usage in % by each process

    • jetole Nov 21, 2010 @ 15:28

      T Sudhakarraj, This is a great answer in order to see the top 10 application based on the percent usage but I thought I could help improve it a little. As you probably know, most hard core/old school bash programmers often object to using more commands then you need to get the output you want. When you are performing this command, it’s important to realize that the percentage shown is a reflection of the RSS size of that application and it does not consider RAM allocated by shared objects / dynamically linked libraries (I hate using that term since most people associate it with Windows DLL files but dynamically linked library, while the proper term in Windows is also the generic term to refer to these types of libraries / objects on any OS).

      Because the percentage of RAM shown in ps for any output that uses the %mem / pmem format specifier is in direct correlation with host much data that application has in RSS relative to how much physical ram the host has, you can sort the ouput in ps yourself by using the `–sort rss` option. The final command would look like:

      ps -A --sort -rss -o comm,pmem | head -n 11

      The output would look like:

      COMMAND         %MEM
      kvm              5.6
      thunderbird-bin  3.0
      java             2.4

      This will give you the 10 processes using the most ram ( I only showed 3 in my example) as well as the ps header describing each field. If you want to remove the header then you can add the option “–no-headers” (without the qyuotes) to ps. If you remove the headers in ps, you will probably want to change the head command to use 10 instead of 11 since the extra line is for the headers Also this example only shows the “short” command name or basically it only shows the command but non of the arguments. It also doesn’t show the actual amount of RSS being used. If you want to show the “long” command or basically the command name with all the arguments, replace “comm” with “cmd” in the ps options. If you want to display the actual amount of RSS being used by each app in the top 10 list, replace “comm,pmem” with “comm,pmem,rss” and it will now have three columns for command, percent of memory and kilobytes of RSS used instead of just command and percent of memory.

      Also, unfortunately ps doesn’t have the option to convert kilobytes to megabytes. This can still be displayed but it requires a bit more of a complex answer. In order to display the RSS usage in megabytes instead of kilobytes we run through a loop and do the math ourselves on each line.

      while read command percent rss; do if [[ "${command}" != "COMMAND" ]]; then rss="$(bc <<< "scale=2;${rss}/1024")"; fi; printf "%-26s%-8s%s\n" "${command}" "${percent}" "${rss}"; done < <(ps -A --sort -rss -o comm,pmem,rss | head -n 11)

      The example below calculates the megabytes used by each applications RSS rounded to nearest 100th of a whole number. You can change this to show more or less places after the decimal by changing "scale=2" to whatever number you like.

      Hope this helps some people.

      P.S.: I saw that the term RSS was used by someone before me but I don't see anywhere on this thread where anyone has defined it. RSS as it relates to RAM (on any OS as far as I know) is the portion of memory that a process is using that is held in RAM. Every process has RSS and RSS does not include any items in RAM which have been swapped to disk or are otherwise anywhere else then in the physical RAM. This means that the size of each programs RSS is the amount of data that program itself is storing in physical RAM.

      • NoNeedForAName Apr 15, 2012 @ 18:52

        Hope this helps some people.

        Yes, yes it does. Bloody Apache. Thanks jetole.

  • azaz mustafa Jun 10, 2010 @ 10:39

    Actualy memory is not used by application | swap file memory is 1534196 and uses 0
    so pleas solution


  • dipul Jun 11, 2010 @ 9:43

    how we can know status of the RAM through the JAVA Programming?


  • Mohammed Aug 5, 2010 @ 11:30

    Hi All,
    We use a hospital Information system application. From 10:30 AM the performance becomes really slow and the application freezes. Not sure if it is due too many sessions open or number of client connections or cpu/memory issue.
    We have the application installed on all client machines. The application server running on RHEL 5.2 version on IBM Balde work stations with 2 node cluster. App server is connected to Oracle 11g Db server.
    Currently, we restart the the application server every 2 days after working hours and see that the performance back to normal. But if we do not restart the servers, the performance is bad again.
    Please let me know what all things I need to check here so to know what is causing the performance issue.


    • Techie Talks Sep 28, 2010 @ 4:56

      Try to kill unused running commands/applications.

  • Krunal Sep 17, 2010 @ 18:39

    I want to get the cat output in memory buffer. Can anybody please let me know how it is possible.

  • BK Sep 22, 2010 @ 4:32

    Can you pleas tell me how can I check Guaranteed Ram and Burstable Ram from shell prompt?

    Thanks alot

  • Techie Talks Sep 28, 2010 @ 4:53

    cyberciti has been my partner since we had linux servers in the office, thank you and hope you will continue this site and more power to the webmaster and all its staff.

    • NoNeedForAName Apr 15, 2012 @ 18:53

      Seconded. Cyberciti is better than



  • bharath vn Oct 25, 2010 @ 11:54

    Hey guys,

    i see my sites apache uses more memory around 4G, after restarting it release 3G.

    The actual problem is Apache keeps increasing its memory usage.

    Do you guys know how to overcome this issue.

    Thank You

  • maclean Nov 5, 2010 @ 7:07

    Linux memory management is more flexible than windows

  • muthukumar Nov 16, 2010 @ 8:21

    Hi guys,

    how to setup the IP address in running production server

    thanks in advance

  • mahes Nov 30, 2010 @ 10:44

    hi guys.
    The top 10 application are using 0% mem for ME …but top says..

    Mem: 4145948k total, 2776936k used, 1369012k free, 146512k buffers
    Swap: 1558296k total, 4k used, 1558292k free, 2467592k cached

    out of 4G ram 2.6 is already used..WIll the kernel allocate if a process require more than the free memory. Wat process is actually using the used one .??

    kindly help me with this.

    n 11id:/localdisk/lattice/lattice_36041# ps -A –sort -rss -o comm,pmem | head
    ntpd 0.0
    named 0.0
    vim 0.0
    bash 0.0
    sshd 0.0
    sshd 0.0
    sshd 0.0
    sshd 0.0
    bash 0.0
    sshd 0.0

    • jetole Nov 30, 2010 @ 15:29

      I see your using the command I mentioned above but with one less item in the head command output but that’s alright ;)

      You can show the same data, without limiting the input but also displaying the RSS usage (and the pid) for each process by running:

      ps -A –sort -rss -o pid,comm,pmem,rss

      The far right column will show you the RSS usage in kilobytes. The order is descending so the application with the highest allocated RSS (using the most) is at the top of the list. The application with the lowest allocated RSS (using the least) is at the bottom of the list. Remember that RSS is only referring to the memory you application is using that is actually in RAM and does not include anything swapped to disk so this is in fact the amount of RAM your application is using.

      Something important though that you may not have realized is that Linux tends to use almost all available memory whenever it can by default. Linux will leave an percent free (I don’t know how to check what the percent is but it doesn’t matter) and then it will allocate the rest to buffers and cache. The general idea is this, buffers is the smaller segment it allocates for I/O usage of processes that are running. This mostly refers to items that programs need to write to a disk but that data is often cached in memory and then written. This causes programs not to have to wait for I/O to complete and the kernel is then able to write the data to disk as quickly as it’s capable of doing but at the same time without having to have a program and hence the user wait for the information to be written to disk. The buffers are also used for IPC or inter process communication. The cache is mostly used for reading files off disk. The algorithm is uses, while complex, basically stores a combination of files that are popular and recent in cache memory. This speeds up disk read times a lot too. You will notice that the cache is almost always significantly larger then the buffers. You can view both of these using free to see total, used and free memory. You can use free -m for megabytes and free -g for gigabytes.

      This RAM, more quickly with cache then buffers, can be very quickly (on both) be released and therefor given to any process asking for RAM. This means that, although this RAM is used and it is used in way that speeds up your system, if any task needs the RAM, it will instantly be given to that process. One example would be if I start VLC movie player and VLC needs and therefor requests 50MB to run, then the kernel will free 50MB from cache and buffers and allocate it to VLC. This is why there is also a line when you run free which says “-/+ buffers/cache”. This line which shows numbers under used and free, isn’t the RAM you literally have used and literally have free because of ram allocated to cache and buffers, however it is the line you should refer to when you want to see how much free RAM you have because RAM allocated to buffers and cache will be instantly released and given to a process whenever it needs it.

      When you view your free memory inside top, it shows you the literally used RAM and literally free RAM meaning cache and buffers are added to used and subtracted from free and their is nothing wrong with this but the RAM inside cache and buffers is still available to you when you need it. As I mentioned, the best way to really see how much used and free RAM you have is to look at the “-/+ buffers/cache” line inside free. That line is there for a reason.

      Hope this helps.

      • jetole Nov 30, 2010 @ 15:36

        Ah I forgot that the forum breaks double hyphens by default (poor mans attempt to stop SQL injections maybe?). The actual command I have up top is

        ps -A --sort -rss -o pid,comm,pmem,rss

        Notice the double hyphens in front of sort.

    • Ashok Dec 9, 2010 @ 17:08
      # Developed by Ashok Kumar
      # 1:50 PM Monday, February 04, 2008
      TOT=`cat /proc/meminfo | grep MemTotal: | awk '{print $2}'`
      USED=`cat /proc/meminfo | grep Active: | awk '{print $2}'`
      FREE=$[$TOT - $USED ]
      echo > $LOG
      if [ "$USED" -gt "0" ]; then
         USEDPERC=$[$USED * 100 / $TOT]
         echo "Used Percentage      : $USEDPERC %"
         TOTMB=$[$TOT / 1024 ]
         USEDMB=$[$USED / 1024 ]
         FREEMB=$[$TOTMB - $USEDMB ]
         #echo "Used Percentage : $USEDPERC"
         if [ "$USEDPERC" -gt "80" ]; then
           echo "------------------------------------------------------------------" >> $LOG
           echo `hostname`   >> $LOG
           echo "------------------------------------------------------------------" >> $LOG
           echo "Total Memory (MB)    : $TOTMB" >> $LOG
           echo "Used Memory (MB)     : $USEDMB" >> $LOG
           echo "Free Memory (MB)     : $FREEMB" >> $LOG
           echo "Used Percentage      : $USEDPERC %"  >> $LOG
           echo "------------------------------------------------------------------" >> $LOG
           if [ "$USEDPERC" -gt "95" ]; then
      if [ "$FREEMB" -eq "0" ]; then
         echo "------------------------------------------------------------------" >> $LOG
         echo "    No free memory available in " `hostname`    >>$LOG
         echo "------------------------------------------------------------------" >> $LOG
      • Ashwin Mar 23, 2011 @ 1:15

        Thanks Ashok

      • guest Apr 23, 2016 @ 12:10

        Thanks !

  • mahes Dec 1, 2010 @ 6:10

    Hope this helps.”

    Thanks a lot boss , great explanation . is of great help to me as i am able to free up my mem , used by so many ssh process :)

  • riyan Dec 3, 2010 @ 4:49

    Hi, Great Article. is there any way to find the memory usage history of SUSE Linux server?

  • jetole Dec 3, 2010 @ 11:20


    Yes and no. Generally speaking, Linux the kernel doesn’t do any real auditing / logging of memory usage but then again it shouldn’t either since Linux really is only a kernel so you will need to install another tool to deal with this. The most common / popular / recommended tool for this would be sysstat / sar and on quite a few distros (Debian, Ubuntu, CentOS), sysstat is the literal name of the package you want to install. Once installed, it will start logging the data but their really is no way for it to record data from before it was installed so basically, if you don’t have a audting / logging application like sysstat already installed then you can’t really view the past history until after it is.

  • Vaseem Jan 7, 2011 @ 4:44

    you can try from the terminal
    cat /proc/meminfo
    cat /proc/cpuinfo
    This will give you information regarding the memory and CPU

    • mouli Aug 25, 2011 @ 5:32

      they both are shows the configuration information…
      and the command to see the cpu information is ”lscpu”

      • Sandeep Mar 9, 2013 @ 10:19

        Exactly! You simply figured out this…

  • Itzekocke Apr 12, 2011 @ 11:28


    that all helped a lot – even if the information is more than 5 years old!


  • peter May 1, 2011 @ 16:12

    fantastic article! thanks very much for your thourough and clear explaination, great job!

  • pat Jul 31, 2011 @ 0:04

    Hi Im new to linux and have an older acer 340t travel mate i went into BIOS but didnt see how much memory i have..How to i get into where i can type commands to fine out how much memory It has and what would the command be. Thank you so much for your help

    • Tryme Jul 31, 2011 @ 23:19

      Open a command-line terminal (select Applications > Accessories > Terminal), and then type:

      free -m
  • Timothy Asir Aug 10, 2011 @ 9:11

    MemUsed = MemTotal – MemFree – Buffers – Cached

    We can take the values from /proc/meminfo and calculate this;
    and can verify with gnome-system-monitor output.

  • Aziz Zoaib Sep 28, 2011 @ 5:19

    How to check CPU and memory utilization of previous days ?

    any commands ?

  • Timothy Asir Sep 30, 2011 @ 9:49

    Then, you have to use RRD.
    1) create an RRD (database) for CPU and memory utilization using rrdtool. You can also write a script to do that using perl or python. In perl you can use (RRDs::create).

    2) Update the RRD with cpu and memory details periodically (on every 5-mints or hour)

    3) Use rrdtool xport / rrdtool graph command to get details of a specific period (hour/day/week/month/year)

    • jetole Sep 30, 2011 @ 11:20


      That’s rather crude. You don’t need to program anything to get these stats nor do you need to write RRD scripts. One method that has been used by many system administrators for a long time is through sysstat though this is all console based. If you prefer a web based GUI with RRD graphs then cacti is already programmed to monitor all of this for you. There are also probably several dozen other ways to do this so you probably shouldn’t use terms like “Then, you have to use RRD”. Because you only know one way to do it doesn’t mean it’s the only way and you shouldn’t be dismissive.

      P.S.: You’re explanation seems to be lacking lacking a lot and the first thing I notice is how often you update the RRD is based on how often you have configured and RRD to be updated. An RRD database designed to be updated every 5 minutes would be pretty much useless if you update it every hour based on the way RRD is designed to implement this data. A better approach is to log this data (at least) twice as often you want it to be available, for example, if you want a daily bar graph of cpu usage with 48 points of input from data collected every 1/2 hour then log the data at least every 15 minutes. When you are you want to view this data then you dynamically create the RRD based on the the specifications you supply at the time and this way you are not bound to one poorly designed RRD component which you may have implemented ‘a long time ago” and now you are forced to use it even though you need statistics at an entirely different rate then what you had originally planned “way back when”

      • jetole Sep 30, 2011 @ 11:21

        P.P.S.: I forgot to mention Munin which is another web based RRD based performance monitoring application.

  • jetole Sep 30, 2011 @ 11:31

    One more P.S.: I use sysstat, cacti, munin and more to monitor the server farm I am responsible for. They all provide the same details in a general sense but in a detailed sense they are all different from one another in a way that one doesn’t entirely replace the other and I feel it’s best to implement whatever provides you with the details you need in a useful and efficient manner and if this means you have to use more then one tool for different ways to comprehend the data then there is nothing wrong with that. This isn’t Windows where you have to worry about product cost, contract lock in’s and vendor abuse so install 10 products if you need it and if you decide to install 20 just to see which ones ultimately give you the info that you need then there is nothing stopping you (at least not for most Linux tools. I can’t speak for all of them).

  • sureshatt Oct 10, 2011 @ 6:49

    thanks dude, nice tutorial

  • Ravinder Kumar Oct 13, 2011 @ 13:52

    Hi ,

    I have problem in one linux application server where 3 instaces is running of java, each instaces is alocated 1 gb memory but my server is using my 21 gb memory , i am surprised for this.

    Can anyone help me , i checked with many command but nothing found….

    Thanx in advance….

  • Jussi Nov 27, 2011 @ 11:03

    You folks might be interested in systemgraph named data collector/rrdtool/web cgi framework, that produces easily many kind of stats for system resource usage; see

  • escorte Dec 23, 2011 @ 8:42

    Any ideea why on a CentOS 5.7 Final linux box, 64 bit version, my system only recognized 3261 MB RAM instead of 4 GB installed? When it boots and also in BIOS all 4 GB ram are shown, but under linux I only see 3,2 GB. Thanks!

    • 🐧 nixCraft Dec 23, 2011 @ 9:48

      Are you sure you got 64 bit CentOS Linux? 64 bit can address 4Gib and more ram without any problem.

  • Nirav Feb 15, 2012 @ 14:49

    How can I find only memory utilization [not in percentage] and only I/O utilization [not in percentage].

  • Jason Feb 17, 2012 @ 14:14

    I recently discovered “htop”. This is a really nice tool to see your resources being used via your terminal and even offers point and click functionality!

    On Redhat-based systems simply type:
    # yum install -y htop

    Then from the command-line run:
    # htop

  • jetole Apr 15, 2012 @ 19:26


    free (-k -m or -g for showing in kilo, mega or gigabytes) for memory usage
    iostat for disk io. Should be part of the systat package

  • vivek Jul 2, 2012 @ 10:38

    Hello all,

    Please let me know when i run command free -m on any linux box with 8GB assign ram it show me 7873 MB please let me know is linux kernel reserved any memory or where is 319 mb memory is use.

  • Chirag Aug 14, 2012 @ 6:54

    Thanks. Awesome guide

  • sanjay Mar 5, 2013 @ 7:02

    hi sir
    Iam using linux os in friendlyARM
    I am having 64 MB of ram so it is using 64 MB but i want to limit it, it
    means i want 100 kb memory for future usage so restrict 64 MB ram to
    (64MB-100KB) (shortly: don’t use last 100 KB ram)
    command to overcome with program consuming too much RAM
    how it can be done ….can any one suggest me

  • linux admin Apr 3, 2013 @ 17:34

    Anyone know how to find out what type of ram the server uses and how many sticks by command with Linux 6?

    For example my server has 4 gigs of ram, I am trying to find out if it has 4 1gb sticks or two 2gb sticks.

    Also I am trying to find what kind of ram, for example if it’s ddr3 1600


    • Stan Oct 27, 2015 @ 15:00

      dmidecode -t 17

      Handle 0x0021, DMI type 17, 34 bytes
      Memory Device
      Array Handle: 0x0009
      Error Information Handle: Not Provided
      Total Width: 72 bits
      Data Width: 64 bits
      Size: 8192 MB
      Form Factor: DIMM
      Set: 21
      Locator: DIMM 24
      Bank Locator: Node 1 Bank 24
      Type: DDR3
      Type Detail: Registered (Buffered)
      Speed: 1600 MHz
      Manufacturer: Samsung
      Serial Number: 36378A02
      Asset Tag: Unknown
      Part Number: M393B1K70DH0-CK0
      Rank: 2
      Configured Clock Speed: 1600 MHz

  • jetole Apr 4, 2013 @ 16:09

    lshw. comes standard on many systems including debian, ubuntu. etc. Last time I looked at rhel, cent, etc you need to add a third party repo.

  • Jose Tapia Apr 13, 2013 @ 6:53

    Great article, saving on bookmars :D

  • Silver Moon Jun 12, 2013 @ 13:12

    Thanks for the great tutorial.
    Really helpful in monitoring the resource usage on my server.

  • Chowdary Aug 6, 2013 @ 15:32

    Hey All,

    How do I get the memory usage details in last 5 hours ? or let’s say Last few hours?

    Please suggest.


  • ravi sankar Apr 7, 2015 @ 4:54

    hi ALL,

    Am installing java,nosql,oep,weblogic i want to find how much useage taken by cpu for each tool and RAM and HDD for each tool


    ravi sankar.G

  • Jarrod Apr 27, 2015 @ 5:05

    Nice post, top and free commands are easily my favorite ways to quickly check memory usage!

  • Jegan Jul 9, 2015 @ 7:53

    Hi Team,
    Can you assist me to find earlier particular time(may be 2-3 hours before) what process caused more CPU/memory in linux servers ? Thanks in Advance

    With Regards,

  • kozaki Jul 16, 2016 @ 20:23

    Hi guys

    > In this above output, my server has used 2825 MB ram, and 9083 MB is available for other users and programs.

    If Nixcraft run his illustrative sample above with free from procps-ng >= 3.3.10 at the same moment, he wouldn’t get the same available memory. One of them (i.e. `free` == 3.3.10, and Nixcraft ;)) is lying to us.

    I run the two (free versions, not Nixcraft ;)) on the same Arch machine at 1 minute from each, doing nothing else than `pacman -U procps-ng–VERSION.tar.xz). Here’s their output (“available” RAM is under ‘*’):

    $ free -V
    free from procps-ng 3.3.10

    ┌(kozaki@arch)─(0)─(09:59 sat. jul. 16)
    └──> [1][0]$ free -m
    total used free shared buff/cache available
    Mem: 7807 4445 458 477 2903 *2550*
    Swap: 4047 0 4047

    $ free -V
    free from procps-ng 3.3.9

    ┌(kozaki@arch)─(0)─(10:01 sat. jul. 16)
    └──> [1][0]$ free -m
    total used free shared buffers cached
    Mem: 7807 7350 456 474 221 2308
    -/+ buffers/cache: 4820 *2987*
    Swap: 4047 0 4047

    Guys, how much available RAM does this box have atm?
    The one who knows and can explain will get my respect + a mint tea / beer.

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