The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > Linux > Red Hat
.
grep unix.com with google



Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions.

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-23-2009
Registered User
 

Join Date: Nov 2009
Posts: 2
Angry To get the memory in MB

Hi
I am trying to get the memory in the box using the belkow command. this is giving me the proper result in KB's. I would like to convert it into MB's.

cat /proc/meminfo | grep MemTotal | cut -d " " -f6
32962184

But when I execute the below command, its throwing the error.

expr ` \( cat /proc/meminfo | grep MemTotal | cut -d " " -f6 \) / 1024 `
-bash: (: command not found
cut: ): No such file or directory
cut: /: Is a directory
cut: 1024: No such file or directory
expr: missing operand
Try `expr --help' for more information.


Can somebody please suggest me how to do it?
  #2 (permalink)  
Old 11-23-2009
scottn scottn is offline Forum Staff  
Moderator
 

Join Date: Jun 2009
Location: Zürich, CH
Posts: 1,611
No need for cat, grep, cut, and expr.


Code:
awk '/MemTotal/ {printf( "%.2f\n", $2 / 1024 )}' /proc/meminfo

  #3 (permalink)  
Old 11-23-2009
Registered User
 

Join Date: Nov 2009
Posts: 2
Thanks a lot Scottn, Now its working
  #4 (permalink)  
Old 11-24-2009
Registered User
 

Join Date: May 2008
Posts: 387
or you can try this:


Code:
vmstat -s -S M | egrep -ie 'memory|swap'

Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Logic 9: About memory management and memory alert dialogs Linux Bot OS X Support RSS 0 11-17-2009 05:00 PM
How to deal with lots of data in memory in order not to run out of memory emitrax High Level Programming 1 05-28-2009 11:09 AM
How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9 0ktalmagik SUN Solaris 4 02-03-2009 09:37 AM
how to round up a memory address(memory alignment problem) nj302 High Level Programming 6 09-21-2005 09:57 PM
Shared memory shortage but lots of unused memory cjcamaro UNIX for Advanced & Expert Users 1 10-13-2004 06:10 PM



All times are GMT -4. The time now is 01:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0