similar command of ptree in linux


 
Thread Tools Search this Thread
Operating Systems Linux similar command of ptree in linux
# 1  
Old 02-03-2011
similar command of ptree in linux

Hello guys,

Is there any command to check the all child processes of a process like `ptree`?
ptree is not working in Linux..

Regards,
Raghu
# 2  
Old 02-03-2011
Could that be pstree?

Code:
$ yum whatprovides */pstree
...
psmisc-22.2-7.x86_64 : Utilities for managing processes on your system.

# 3  
Old 02-06-2011
You can try to use the "--forest" flag of the ps command.
For example: Here is an excerpt from the output of
ps -ef --forest that I ran on my Ubuntu system.
Code:
root       838     1  0 Jan26 ?        00:00:00 gdm-binary
root       966   838  0 Jan26 ?        00:00:00  \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root      1043   966  0 Jan26 tty7     00:00:23      \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-pDbgjo/database -nolisten tcp vt7
root      1302   966  0 Jan26 ?        00:00:00      \_ /usr/lib/gdm/gdm-session-worker
test      1788  1302  0 Jan26 ?        00:00:00          \_ gnome-session
test      1822  1788  0 Jan26 ?        00:00:00              \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
test      1849  1788  0 Jan26 ?        00:00:02              \_ gnome-power-manager
test      1850  1788  0 Jan26 ?        00:00:16              \_ nm-applet --sm-disable
test      1857  1788  0 Jan26 ?        00:00:00              \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
test      1859  1788  0 Jan26 ?        00:00:00              \_ bluetooth-applet
test      1860  1788  0 Jan26 ?        00:00:02              \_ gnome-panel
test      1861  1788  0 Jan26 ?        00:00:00              \_ nautilus
test      1862  1788  0 Jan26 ?        00:00:03              \_ metacity --replace
test      2051  1788  0 Jan26 ?        00:00:00              \_ /usr/lib/gnome-disk-utility/gdu-notification-daemon
test      2061  1788  0 Jan26 ?        00:00:00              \_ /usr/lib/evolution/2.28/evolution-alarm-notify
test      2062  1788  0 Jan26 ?        00:00:00              \_ python /usr/share/system-config-printer/applet.py
test      2072  1788  0 Jan26 ?        00:00:06              \_ update-notifier

As you can see, the output shows the hierarchy of the processes, which is what you were interested in.

Unfortunately, the format of the output has been lost on the post, so the inserted output does not demonstrates the hierarchy. The process name part of sons of processes is indented so that it appears more to the right than that of the father.

Moderator's Comments:
Mod Comment Use code tags to preserve formatting

Last edited by Scott; 02-06-2011 at 10:40 AM.. Reason: Code tags
# 4  
Old 02-12-2011
ps has options which can display the output of processes (and child processes) in tree hierarchy.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

[Tip] ptree for Linux

Unix (and Linux) uses a process tree that gives a natural security, by simple inheritance of attributes. The following ptree script shows it. It runs on all Linux flavors. Mostly useful for debugging. #!/bin/sh # Solaris style ptree && exec /usr/bin/ptree "$@" ... (6 Replies)
Discussion started by: MadeInGermany
6 Replies

2. Solaris

Is there a similar tool with authconfig of Linux on Solaris?

Hi Dears, I believe you know authconfig on most of Linux Distributions. However, on Solaris OS, I don't know the similar tool. Could you please share me the tool, if any? Note: I am using SunOS 5.10. (0 Replies)
Discussion started by: crest.boy
0 Replies

3. Shell Programming and Scripting

another command similar to expect

Hi , I just wondering if there is any command that works similar to the expect command. I'm trying to setup a korn shell script that goes to remote servers and executes a command likes : su - username -c "script to execute " but then it'll prompt for the password so if I can provide... (1 Reply)
Discussion started by: arizah
1 Replies

4. Gentoo

ptree for linux

at work, I'm a UNIX administrator, but at home I use openSUSE 11. One of the commands that I use to assist me in trouble shooting A LOT is called ptree process tree. does anyone know of a ptree for linux? yes, I can just use ps -ef and see who the parent pid is and then 'ps -ef | grep <parent... (4 Replies)
Discussion started by: james.witte
4 Replies

5. Shell Programming and Scripting

equivalent of ptree command in zsh

ptree command is not working in zsh. Could anyone let me know the equivalent of ptree command in zsh. (3 Replies)
Discussion started by: dhams
3 Replies

6. UNIX for Dummies Questions & Answers

Command similar to doskey

Hello all, I need a help in unix. is there any command in unix similar to doskey in MS Dos. It taked pain to enter the big command again and again.. the up and down arrows do not bring the previous commands on the prompt. so pls let me know if there is any command to enable the doskey kind of... (4 Replies)
Discussion started by: halel
4 Replies
Login or Register to Ask a Question