Sponsored Content
Operating Systems Linux similar command of ptree in linux Post 302494224 by dhzdh on Sunday 6th of February 2011 09:30:02 AM
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
 

6 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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
gdm-restart(1m) 						   User Commands						   gdm-restart(1m)

NAME
gdm-restart, gdm-safe-restart, gdm-stop - stop or restart GDM SYNOPSIS
gdm-restart gdm-safe-restart gdm-stop DESCRIPTION
gdm-restart stops and restarts GDM by sending a HUP signal to the GDM daemon. This command immediately terminates all sessions and logs out users currently logged in with GDM. gdm-safe-restart stops and restarts GDM by sending a USR1 signal to the GDM daemon. GDM is restarted as soon as all users log out. gdm-stop stops GDM by sending a TERM signal to the GDM daemon. FILES
The following files are used by this application: /usr/bin/gdm-restart Executable to stop and restart GDM /usr/bin/gdm-safe-restarExecutable to stop and restart GDM safely /usr/bin/stop Executable to stop GDM ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-display-mgr | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. gdm(1), gdmXnestchooser(1), gdmflexiserver(1), gdmphotosetup(1), gdmsetup(1), gdmthemetester(1), gdmconfig(1m) NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2004. SunOS 5.10 1 Sep 2004 gdm-restart(1m)
All times are GMT -4. The time now is 07:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy