Finding How Much RAM or Memory is Available in Linux or Unix

There are several methods in Linux or Unix machines to determine how much RAM or memory you have installed on your machine. Though most of these commands are available across different and all Posix platforms, some are also dependant on the Linux distributions and what libraries you have installed.

The easiest way to find out as to how much memory is installed on your system is to use the command shell. There are also a couple of GUI options depending on your distro.

You can use the free command to find almost all information about the RAM or memory usage and availability. There are command line options available to print the information in bytes, kilobytes, megabytes or gigabytes. –human (or -h) will print the output in human readable format, while –total (or -t) will add a row which totals the columns.

bash$ free -ht

Using free command in Linux

There is also the option to print out the lowest and highest memory usage statistics using -l.

bash$ free -htl

Output of free command with high and low stats


Another command line option is using the top command. Though primarily used to display process information, it also displays some information about the installed RAM (random access memory) or the memory. Look for information at the top of the output, where it says KiB Mem which displays the total available memory on the system.

bash$ top

Output of the top command in linux


Another option is to check the kernel ring buffer output to see what the kernel detected during the system startup about the installed memory. This information is printed out with a line prefix Memory. So, the following command will print out the memory information…

bash$ dmesg | grep Memory

will output something like

Memory: 6156316k/7012352k available (4648k kernel code, 63836k reserved, 2402k data, 424k init, 5307208k highmem)

The first part of the output is the value that you are looking for.


Apart from the free and top command, most distros also have a GUI option which shows the entire system information including the installed memory.

In Gnome, gnome-system-monitor will show you the memory usage and the total memory installed on the system. You can access this from a terminal by the command gnome-system-monitor or access it from the menu, look for by the name System Monitor.

Screenshot of Gnome System Monitor


In KDE, the equivalent GUI option is ksysguard. Again you can access it by the command ksysguard at the command prompt or look for it in the KDE menu by the name System Monitor.

Screenshot of ksysguard in Kde Linux


Though all the above commands and programs will give you a somewhat detailed information about the memory status on your system, that is not all you can find. You can find a plethora of information about your installed memory from the process file meminfo. If you are just looking to find the total memory installed on your system, then this might actually be an overkill.

bash$ cat /proc/meminfo

output of meminfo process file

As you can see there is lot of information in the output, actually way more than what the above screenshot shows. You can use the grep command to narrow the output down to the memtotal row, which shows you the total installed memory on your system.

bash$ grep -i memtotal /proc/meminfo


  • Andreas

    Hi, I’ve done adjusted someone elses code to make use of a so called Geeklet for Mac (part of Geektools).

    I’m using the code line: top -l 1 | grep PhysMem: | awk ‘{print $10}’

    – Do you know if there’s a command in unix that works on Mac that forces the output to be shown in either MB or GB? I’m asking because when free memory goes from 9999 MB and over it changes to 10 GB which really screws up the scripts math formula.

    • Barkeep

      Sorry. I am not that proficient in Mac systems. I will do some testing and let you know if I can figure something out.