In this article we will see basic commands to check physical memory on server in Linux. Many beginners struggle with knowing their system well in context to resources like CPU, Memory, disks etc. So I decided to write this small article pin pointing commands to check RAM on Linux server. These commands will work in different flavors of Linux like Red Hat, CentOS, Suse, Ubuntu, Fedora, Debian etc.
Without much delay lets dive into commands –
1. Using free command
First command is free. This is simplest command to check your physical memory. This command is mainly used for checking RAM and SWAP on system. Using different switch you can change the byte-format of output. Like
-b
for bytes, -k
for kilobytes, -m
for megabytes and -g
for gigabytes.
Check row with
Mem:
and number against it. Thats the physical RAM of your server.
In above output you can see system is installed with 125GB of physical RAM (observe highlighted rows). By using different switch
-b
, -k
, -m
and -g
output changed numbers according to selected byte-format.2. Using /proc/meminfo file
Another way is to read memory info from proc filesystem.
/proc/meminfo
is the file you should read to get detailed information about memory. The very first line or line starts with MemTotal
is your total physical memory on server.
As you can see from output, memory is displayed in kilobytes.
3. Using top command
Famous top command also lists physical memory information in very clear way. In upper section of top command output lies the CPU, Memory and SWAP information.
I clipped above section of top command output in above example. Check second last line saying
Mem:
(highlighted row). This shows physical memory in kilobytes. You can see total, used and free portions of it. Total is your actual RAM installed on server.4. Using vmstat
Another way is to use
vmstat
(virtual memory stats) command with -s
switch. This will list memory in details with first line being total memory on server.
Memory is displayed in kilobytes by default. Very first line shows you total memory on server.
0 comments:
Post a Comment