I'm running under debian squeeze, and need to get processes list in very specific format. Processes are started in following way:
/$script -- $param
Hereinafter I will call $script as "test.sh", so it would look like this:
/test.sh -- 99
I need to find all these processes pid list + their first argv parameter (there is only one argv parameter always):
$pid | $argv
I found that ps can output process list in user format with flag -o, for a moment my solution is: ps -C script.sh -o pid,command=
, that returns the following:
6660 /bin/sh /var/www/test.sh -- 15
7012 /bin/sh /var/www/test.sh -- 18
7041 /bin/sh /var/www/test.sh -- 19
7541 /bin/sh /var/www/test.sh -- 16
7741 /bin/sh /var/www/test.shq -- 1
is it possible to show this output as following somehow?
6660 15
7012 18
7041 19
7541 16
7741 1