LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-25-2004, 02:33 AM   #1
ssnkumar
LQ Newbie
 
Registered: Mar 2004
Location: Bangalore
Posts: 26

Rep: Reputation: 15
Linux/Unix Command to find RAM size?


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

-ssnkumar
 
Old 03-25-2004, 02:41 AM   #2
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 32
cat /proc/meminfo on my machine.
 
Old 03-25-2004, 03:38 AM   #3
ssnkumar
LQ Newbie
 
Registered: Mar 2004
Location: Bangalore
Posts: 26

Original Poster
Rep: Reputation: 15
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
 
Old 03-25-2004, 03:54 AM   #4
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
dmesg | grep Memory

but that prints out other info as well. Are you using this in a script?
 
Old 03-25-2004, 03:58 AM   #5
jkobrien
Member
 
Registered: Jun 2003
Location: Dublin, Ireland
Distribution: Slackware, LFS, Ubuntu, RedHat, Slamd64
Posts: 507

Rep: Reputation: 30
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
 
Old 03-25-2004, 04:10 AM   #6
ssnkumar
LQ Newbie
 
Registered: Mar 2004
Location: Bangalore
Posts: 26

Original Poster
Rep: Reputation: 15
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
 
Old 03-25-2004, 04:33 AM   #7
snacky
Member
 
Registered: Feb 2004
Distribution: Debian
Posts: 286

Rep: Reputation: 30
There is no such command. jkobrien's suggestion works beautifully, though. I suggest you stick to it.
 
Old 03-25-2004, 05:01 AM   #8
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
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 .
 
Old 03-25-2004, 05:47 AM   #9
ssnkumar
LQ Newbie
 
Registered: Mar 2004
Location: Bangalore
Posts: 26

Original Poster
Rep: Reputation: 15
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
 
Old 09-09-2009, 09:38 AM   #10
tibbst
LQ Newbie
 
Registered: Oct 2008
Posts: 2

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/proc/kcore size doesn't match with physical ram size cash_05 Linux - Newbie 2 06-01-2005 01:23 PM
Why should you give the size of the swap disk as twice the size of RAM vmniza Linux - Newbie 3 09-17-2004 02:13 AM
unix command to linux command leonidas Linux - General 1 09-10-2004 12:40 AM
command to find size of a dir Longinus Linux - Newbie 3 08-01-2004 08:19 PM
Command to find total file size satimis Linux - Newbie 1 01-22-2004 11:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration