|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Top utility in bash for loop
Dear All,
is it possible to use top utility in for loop? I am trying to get top swap space consuming processes in my for loop. I got multiple way (using /proc FS) however have anybody used top command in for loop? Using /proc FS giving solutionbut itrs more complex. Please suggest if anybody has simpler solution |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
You can do the following to achieve this:-
I hope this helps. |
| The Following User Says Thank You to Yoda For This Useful Post: | ||
mail2vivek1 (12-02-2012) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Thanks for reply Bipin!!!
However this method works only on terminal... any trick to use it in bash script/loop... I meant, how the script will understand option O and P in for loop/shell script |
|
#4
|
||||
|
||||
|
Once you have saved the settings to .toprc using W option, then you don't have to use option O & p anymore. Your top command will always display processes sorted by SWAP usage. Please give it a try and see if you are getting the desired result.
|
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
Hi, you can use something like: Code:
top -o size -n 1 Last edited by Franklin52; 12-03-2012 at 06:21 AM.. Reason: Please use code tags for data and code samples |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using variables created sequentially in a loop while still inside of the loop [bash] | DeCoTwc | Shell Programming and Scripting | 2 | 06-23-2009 04:59 PM |
| top command line utility | antoniomorandi | Programming | 6 | 11-20-2007 07:38 PM |
| Unload utility with loop method | cedrichiu | Shell Programming and Scripting | 1 | 07-02-2007 08:55 AM |
|
|