How to check RAM in Ubuntu through terminal. On Ubuntu, check RAM usage via command line. Ubuntu users can also check RAM type using Terminal commands.
Random-access memory (RAM) is a form of computer data storage which stores frequently used program instructions to increase the general speed of a system. A random-access memory device allows data items to be read or written in almost the same amount of time irrespective of the physical location of data inside the memory. In contrast, with other direct-access data storage media such as hard disks, CD-RWs, DVD-RWs and the older drum memory, the time required to read and write data items varies significantly depending on their physical locations on the recording medium, due to mechanical limitations such as media rotation speeds and arm movement.
How to Check RAM Size in Ubuntu
Command 1
grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
MemTotal displays the total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code.
grep MemTotal /proc/meminfo
Command 2
The /proc/meminfo, one of the files in the /proc/ directory, displays information about the system’s RAM usage. The argument MemTotal shows the total amount of usable RAM, in kibibytes, which is physical RAM minus a number of reserved bits and the kernel binary code.
cat /proc/meminfo
Command 3
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo. The displayed columns are:
total Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
used Used memory (calculated as total – free – buffers – cache)
free Unused memory (MemFree and SwapFree in /proc/meminfo)
shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if not available)
buffers Memory used by kernel buffers (Buffers in /proc/meminfo)
cache Memory used by the page cache and slabs (Cached and Slab in/proc/meminfo)
Please note that the last two items, cache and buffers, is memory reserved by the kernel.
free -m
free -g
free -k
Command 4
vmstat reports virtual memory statistics. vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity. The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case.
vmstat