Find the answer to your Linux question:
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 ...
  1. #1
    Just 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

  2. #2
    Just Joined!
    Join Date
    Apr 2009
    Posts
    15
    I was able to get this working.

  3. #3
    Just Joined!
    Join Date
    Jul 2008
    Posts
    81
    How about telling the rest of the world what you did that worked.

  4. #4
    Just Joined!
    Join Date
    Jun 2004
    Location
    Halesowen, West Midlands, UK
    Posts
    71
    Quote Originally Posted by clowenstein View Post
    How about telling the rest of the world what you did that worked.
    $ 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

  5. #5
    Just Joined!
    Join Date
    Jul 2008
    Posts
    81
    If all you want are process IDs, have you considered the command "pgrep"?
    Like:
    $ pgrep firefox

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...