Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I need is, given a process id, list all his children without any clutter (table header, other columns than the pid)

What I have is :

ps h --ppid $PID

Which gives me:

26277 pts/13   S+     0:10 cmd1
26280 pts/13   S+     0:10 cmd2
...

Using h allow me to hide the table header.

Is there a way to tell ps to not print the pts/13 S+ 0:10 cmd part in order to get a list of children process ids separated by carriage return?

Thank you!

share|improve this question
up vote 12 down vote accepted

This should work:

ps h --ppid $PID -o pid
share|improve this answer
    
Thank you, it works :) I thought of using -o before, but in my tests ps threw me a syntax error. (I think I had concurrent switches when I tried it...). – katsuo11 May 20 '11 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .