top command
Hi everyone,
I want to run Top command in batch mode every 10 seconds for 10 iterations & at the same time I want to limit the number of process shown in the top command output. I'm unable to locate how to do that ,please suggest I'm using the below command & this is printing all the process running on the system , I want only 5 processes to be displayed in each iteration.pls help Quote:
|
Do you have any particular 5 in mind, or will any do?
If the latter, use tail Code:
top -b -n 1 -d 1|tail -5 |
This will not work as I want to iterate the output 10 times after every 10 seconds , using tail will output once one.
And I want the top 5 processes hence using tail command is not appropriate. |
Try this:
Code:
top -b -n 10 -d 10 | tail -5 |
Code:
for i in {1..10}; do top -b -n 1 | tail +7 | head -6; sleep 10; echo ""; done Code:
for i in {1..10}; do top -b -n 1 | head -n 12; sleep 10; echo ""; done |
All times are GMT -5. The time now is 04:07 PM. |