LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2011, 03:52 AM   #1
eidbadrlt
LQ Newbie
 
Registered: Nov 2011
Posts: 11

Rep: Reputation: Disabled
runing top command without continuous updates


Hi,
im running a perl script to get processes information

Code:
open(STATS, "top|") || die "$!";
but i want top to run only once and not to update continuously.

is it possible to make it display process informations only once and exit?
 
Old 11-21-2011, 03:58 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Yes. Run top in batch mode (option -b) and ask for only one iteration (-n):
Code:
top -b -n1
 
1 members found this post helpful.
Old 11-21-2011, 04:29 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,522

Rep: Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039Reputation: 2039
Would be a good idea to use the manpage. You may not get what you expect.
 
  


Reply


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
[SOLVED] bash command history log - how to write it continuous? Skaperen Linux - Software 12 04-15-2011 02:56 PM
Updates = continuous size bloat? Changes Linux - General 4 04-05-2011 03:33 AM
LXer: Can You Top This? 15 Practical Linux Top Command Examples LXer Syndicated Linux News 0 01-09-2010 09:42 PM
Apache Commons telnet connection with a continuous command clb Programming 2 12-29-2008 01:09 PM
runing the make command Paridoth Mandriva 4 10-30-2004 05:57 PM


All times are GMT -5. The time now is 12:21 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration