The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-19-2007 10:52 PM
Debian: doubt in "top" %CPU and "sar" output jaduks Linux 0 09-12-2007 05:05 AM
"highlighting the text in ur output" sakthi.abdullah Shell Programming and Scripting 6 12-11-2006 02:51 PM
Use "read" with a text file with comments mbarberis Shell Programming and Scripting 3 03-29-2005 11:24 PM
Convert "text" to "packed-decimal"? HuskyJim UNIX for Dummies Questions & Answers 2 06-08-2001 11:59 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 09-20-2006
Registered User
 

Join Date: Aug 2005
Posts: 10
Piping output of "top" to a texf file

I would like to pipe "top -n" to a text file, but I get an error:

top: cannot open /dev/kmem
kvm_open: Permission denied

I am a non-root user.

If I could find a way to get this type of output:
"Memory: 2048M real, 1516M free, 4099M swap free"
into a text file, I could further automate my daily system healthchecks.

Any ideas would be appreciated. Thanks so much.
Reply With Quote
Forum Sponsor
  #2  
Old 09-20-2006
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
See this post and check your man page for top.
Reply With Quote
  #3  
Old 09-20-2006
Registered User
 

Join Date: Aug 2005
Posts: 10
Thanks, RTM, for your quick reply. I did search the forum before posting, but did not find the post you reference. I did also try man and google and the Sun site, but could not find the help I needed. (Just so you know, I am not a lazy newbie, just a clueless one!)

I do not have man pages for top on any of my five Solaris servers. This is probably because I rigged top to run by myself, as I couldn't get a unix admin who had time to do it. I copied an executable from somewhere else & got it to run. But I did not so an actual install.

These are the options I have for top on my machines:
Top version 3.5beta8
Usage: top-3.5b8-sun4u-5.9-64bit [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]

I tried the "-f" option, even though it is not listed, but no success.

Any other ideas you have for me will be appreciated. Thanks so much.
Reply With Quote
  #4  
Old 09-20-2006
Registered User
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 401
How about:

Code:
$ swap -s
total: 52056k bytes allocated + 28144k reserved = 80200k used, 1321528k available
Carl
Reply With Quote
  #5  
Old 09-20-2006
Registered User
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 401
You could also try this:

Code:
$ vmstat 1 2 | tail -1
 0 0 0 1322760 331512 0   7  0  0  0  0  0  0  0  0  0  324  112  154  1  0 99
Position 4 ad 5 are swap and free.

Carl
Reply With Quote
  #6  
Old 09-20-2006
Registered User
 

Join Date: Aug 2005
Posts: 10
Carl,

Thanks so much for your replies.

These will only give me virtual memory, is that correct? Are there similar commands for physical memory usage? I have used vmstat before, but swap is new to me; I'm glad to learn of it.

I am a little embarrassed to be asking such elementary questions. Thanks again.

Shirley
Reply With Quote
  #7  
Old 09-20-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,003
Code:
prtconf -v | grep -i mem
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:20 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0