Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I really like the way ps -T PID works on AIX. It shows you a nice tree of processes in the right side, and their PID, PPID and other info in the left side. In AIX docs, the -T flag reads Displays the process hierarchy rooted at a given pid in a tree format using ASCII art.

Example: ps -T 40632

   40632      -  0:00    |\--telnetd
   40232  pts/2  0:00    |    \--ksh
   32910  pts/2  0:00    |        \--dbx
  987990  pts/2  0:00    |            \--a.out

Without using pstree, is there a way to get the same (or slightly different) output using Linux's ps? It doesn't matter if post-processing of the results is required (using awk, sed, grep, etc...), I just want a way to show the results like the AIX's version, that is, generating a tree of processes showing the PID, the childs, the children's childs, and so on. Besides the fact that Linux's ps -T does not show the format I want, it only output the proceses directly related with the PID (PID + direct childs).

I have tried pstree, but can't make it look like this at all - seems like it only support to have the PID printed beside the name of the process and its arguments, but can't print those in another pane, like AIX's version does.

By the way, I'm using Debian 3.2.35-2 x86_64 GNU/Linux and procps-ng version 3.3.3

share|improve this question

1 Answer 1

up vote 1 down vote accepted

For a simple process tree use ps -acxef -o pid,time,command, to get full command lines displayed, leave -c out ie. use ps -axef -o pid,time,command.

share|improve this answer
    
Thanks, that was exactly what I was looking for. –  jim Mar 14 at 1:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.