Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-04-2008, 08:42 AM   #1
Registered: Feb 2003
Location: Orangeville
Distribution: Fedora
Posts: 477

Rep: Reputation: 31
Question Identify program memory usage from command line

Me again with memory questions.

I have one or many programs that run periodically which have a high demand for memory.

They start up... through a large portion to swap, then finish up and release their memory. Then the 200K-800K or so is filled up with disk cache, and slowly over the day swaps in the 200K-800K.

I want to identify which programs they are. Is there a command line tool, which I can dump the output to log file, that will report the rough memory usage of a program?
Old 03-04-2008, 11:16 AM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912Reputation: 912
top -b -n 1 and a for loop ... for instance to capture
roughly an hour
for z in `seq 1 3600`; do top -b -d 1 -n 1| awk -f top.awk;sleep 1; done | tee topoutput
where top.awk looks something like this (here it would give you the
top-20 memory hogs per run - see head):
  command = "LC_ALL=C sort -k 10,10gr|head -20"
    print line[i]
    print line[i]|& command
  close(command, "to")
  while ((command |& getline out) > 0)
    print out



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find max memory usage for process in Linux by command line kashameni Linux - Newbie 9 06-01-2007 01:39 AM
which program will monitor another programs memory usage? zidane_tribal Linux - Software 3 06-17-2006 05:56 PM
Sendmail command line usage Belghouth Debian 1 12-08-2004 10:54 AM
Memory usage of openGL program cjp Programming 3 09-09-2004 06:28 AM
checking memory usage from command line wrepti Linux - General 2 06-16-2004 10:24 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:02 AM.

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