command to show stats of multiple processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting command to show stats of multiple processes
# 1  
Old 03-10-2012
command to show stats of multiple processes

I am looking for a command that will show me the memory, CPU and I/O usage of multiple Process IDs

ps v <pid> shows for one process ID

is there something similar for multiple Process Ids?

---------- Post updated at 05:43 PM ---------- Previous update was at 05:41 PM ----------

No I am looking for a command like ps v <pid>
# 2  
Old 03-10-2012
How about this?

Code:
ps -elf | egrep "PID1|PID2|PID3"

If you do not have egrep on your system check if grep supports -E flag.
# 3  
Old 03-18-2012
Thanks for the response but, that did not work for me or maybe I am doing something wrong.
I am relatively new to unix scripting and am attempting to write a script that will display the memory, CPU and I/O usage and redirect it to a excel file.
Here is what I currently have:
Code:
#!/bin/sh
#
ps -fu fsgapp | grep -v grep | grep java | awk '{print $2,$(NF-1),$NF}' > /tmp/a1
for i in `cat /tmp/a1`
do
  ps v $i
done

The first two commands give me what I am looking to get however, the ps v $i only shows the stats for the first pid captured from the first ps command.
Is there a way to get that information for all the pids and redierct to an excel file?
please help.
Thanks

Last edited by Franklin52; 03-19-2012 at 04:27 AM.. Reason: Please use code tags for code and data samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ensuring certain processes do not show up in process table

i've read somewhere a long time ago that there's a way to hide the workings of a script in sub functions so that when run, it doesn't show up in the process table. is this really possible? for instance, i need to run a command that has a password in it. and when that;s being run, it can be... (2 Replies)
Discussion started by: SkySmart
2 Replies

2. Red Hat

Command for load stats

Hi, Is there a way that I can find the load usage stats on a cluster (Redhat 4.8)? I want to find out if my jobs are using too many resources. I am not a sys admin. Also, apart from 'top', what other commands can be used to monitor your own jobs as an ordinary user? thanks!! (1 Reply)
Discussion started by: pc2001
1 Replies

3. UNIX for Dummies Questions & Answers

Is there any way to cat multiple files and show filenames?

Hi, Is there any way to do a cat * where it shows the name of each file in the process? Similar to what more does below? $ more ?.sql :::::::::::::: 1.sql :::::::::::::: set linesize 200 select db_unique_name, cast( from_tz( cast(... (5 Replies)
Discussion started by: newbie_01
5 Replies

4. Shell Programming and Scripting

need help ps -e on multiple processes

:)Hi there, I am new to scripting and wanted to see if someone can show me how to grep on multiple processes and send the output to a file in /home/mydir/output. I am aware of ps -ef | grep on 1 process but need help looking up multiple processes, can you use this command ps -elf | grep |pid1... (4 Replies)
Discussion started by: abbya
4 Replies

5. Solaris

Show complete command on command line when we use 'ps'

Hi, When I query using ps -ef, the complete command is not displayed and is truncated. Can you please tell me a method to resolve this ? I have tried the below. ps -ef | cat ps -ef | grep imp >/tmp/t1.txt /usr/ucb/ps -auxw pargs <pid> /usr/ucb/ps -aefyl | grep imp Thanks (11 Replies)
Discussion started by: mk1216
11 Replies

6. Shell Programming and Scripting

kill multiple processes by name

Want to kill multiple processes by name. for the example below, I want to kill all 'proxy-stagerd_copy' processes. I tried this but didn't work: >> ps -ef|grep proxy_copy root 991 986 0 14:45:34 ? 0:04 proxy-stagerd root 1003 991 0 14:45:49 ? 0:01... (2 Replies)
Discussion started by: catalinawinemxr
2 Replies

7. Programming

Capture stdout from multiple processes

I have a number of binaries which I currenlty have no control over. They alright data to stdout. I would like to kick off any number of these binaries and capture and process their stdout. Doing this for one process is straight forward for example - comments and error checking removed for... (6 Replies)
Discussion started by: dvales
6 Replies

8. Programming

Creating Multiple Processes

I am having problems creating multiple forks. I want create a certain number of forks, each call a program and each wait for a different value. How is this accomplished my loop is not doing the trick. for (i = 0; i < 5; i++) { if (fork() < 0) { //print error } ... (3 Replies)
Discussion started by: Vikings1201
3 Replies

9. Shell Programming and Scripting

multiple processes overlap

Hello I've got a script that creates multiple processes, in ksh, to bcp out 6 tables at a time. In the script, we write messages to the log to show our progress; most of the time, the log messages are nice and neat with one per line, like they should be. But every once in awhile, at random, the... (2 Replies)
Discussion started by: stonemonolith
2 Replies

10. Shell Programming and Scripting

Doubt about multiple processes

Suppose that I am performing some operation on an sql database. Lets say process of Searching and then if a value is found, updating it... Now, when I have some millions of records on which the operation has to be performed... Does it help to spawn multiple processes each executing the same... (9 Replies)
Discussion started by: Legend986
9 Replies
Login or Register to Ask a Question