LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Linux/Unix Command to find RAM size? (https://www.linuxquestions.org/questions/linux-general-1/linux-unix-command-to-find-ram-size-162116/)

ssnkumar 03-25-2004 02:33 AM

Linux/Unix Command to find RAM size?
 
Is there any single command to find out RAM size on the m/c?

-ssnkumar

Kovacs 03-25-2004 02:41 AM

cat /proc/meminfo on my machine.

ssnkumar 03-25-2004 03:38 AM

This prints out many other info also. But, I want only ram size.
So, is there any other command which returns only ram size?

-ssnkumar

Crashed_Again 03-25-2004 03:54 AM

dmesg | grep Memory

but that prints out other info as well. Are you using this in a script?

jkobrien 03-25-2004 03:58 AM

cat /proc/meminfo | awk 'match($1,"MemTotal") == 1 {print $2}'

But I don't know if the format of /proc/meminfo varies among distribution.

John

ssnkumar 03-25-2004 04:10 AM

Thanks for all the suggestions...
All these are trying to access proc file system info or from somewhere else and is printing on to the screen.
But, what I am asking for is a command (standard) which prints only the required info.
For example, to know the architecture of my computer I can use arch command. To know the hostname I can use that command.
In the same way, for ram size....?

-ssnkumar

snacky 03-25-2004 04:33 AM

There is no such command. jkobrien's suggestion works beautifully, though. I suggest you stick to it.

JZL240I-U 03-25-2004 05:01 AM

Code:

free
shows the usage of your RAM. I don't know whether an option exists to extract only the total amount physical memory.
Code:

man free
might help ;).

ssnkumar 03-25-2004 05:47 AM

Thanks for the help guys.
All your suggestions are working fine on Linux.
I don't know if they work on other Linux flavors also (I think they will).

Thanks
ssnkumar

tibbst 09-09-2009 09:38 AM

dmidecode
 
Only about 4 years late, but for Googlers, like me...

There is in fact a command to show the memory hardware (even at the time this thread was still active). The command you were looking for was:

dmidecode

Amongst other info from the BIOS, it will show the Physical Memory Array with the maximum memory the system can hold, and then each slot, whether its empty or not.

Other systems evidently also include a command named 'lshw'. You'll have to use the webpage for lshw, though, because it's not on my systems.

thanx,
tRaV


All times are GMT -5. The time now is 04:40 PM.