Results 1 to 5 of 5
Hi,
I'm trying to run ps command so that I can show what xen virtual machines are running on the host server. The only thing that is consistent between each ...
- 05-26-2010 #1Just Joined!
- Join Date
- Apr 2009
- Posts
- 15
Help on grepping for a process
Hi,
I'm trying to run ps command so that I can show what xen virtual machines are running on the host server. The only thing that is consistent between each VM machine is that it contains a -domain-name with the actual virtual machine after it. Each VM varies on the rest of the arguments in the process command. Does anyone know of a way just to return the argument after the -domain-name?
Any help would be appreciated.
Thanks,
Nick
- 05-26-2010 #2Just Joined!
- Join Date
- Apr 2009
- Posts
- 15
I was able to get this working.
- 05-26-2010 #3Just Joined!
- Join Date
- Jul 2008
- Posts
- 81
How about telling the rest of the world what you did that worked.
- 05-27-2010 #4Just Joined!
- Join Date
- Jun 2004
- Location
- Halesowen, West Midlands, UK
- Posts
- 71
$ ps fax|grep <program_name>
lancelot@slipstream:~> ps fax|grep firefox
6711 ? S 0:00 \_ /bin/sh /usr/local/firefox/firefox --sm-config-prefix /firefox-bin-TeXQTT/ --sm-client-id 1014714ddbd5000127465723100000055760016 --screen 0
6720 ? S 0:00 | \_ /bin/sh /usr/local/firefox/run-mozilla.sh /usr/local/firefox/firefox-bin --sm-config-prefix /firefox-bin-TeXQTT/ --sm-client-id 1014714ddbd5000127465723100000055760016 --screen 0
6724 ? Sl 21:33 | \_ /usr/local/firefox/firefox-bin --sm-config-prefix /firefox-bin-TeXQTT/ --sm-client-id 1014714ddbd5000127465723100000055760016 --screen 0
7882 pts/8 D+ 0:00 | \_ grep firefox
lancelot@slipstream:~>
Processes are 6711, 6720 and 6724
- 05-27-2010 #5Just Joined!
- Join Date
- Jul 2008
- Posts
- 81
If all you want are process IDs, have you considered the command "pgrep"?
Like:
$ pgrep firefox


Reply With Quote
