pstree command show the processes and parent-child relationship
It just shows the running process in a tree..
here is an example of output what you get when you run this command…
$pstree
init-+-NetworkManager---{NetworkManager}
|-NetworkManagerD
|-acpid
|-atd
|-avahi-daemon---avahi-daemon
|-bonobo-activati---{bonobo-activati}
|-cron
|-cupsd
|-2*[dbus-daemon]
|-dhcdbd
|-epiphany-browse---{epiphany-browse}
|-events/0
|-events/1
|-exim4
|-gconfd-2
|-gdm---gdm-+-Xorg
| `-x-session-manag-+-gnome-panel
| |-gnome-settings----{gnome-settings-}
| |-metacity
| |-nautilus
| |-nm-applet
| |-seahorse-agent
| |-ssh-agent
| `-{x-session-manag}
|-gedit
|-6*[getty]
|-gnome-keyring-d
|-gnome-screensav
|-gnome-terminal-+-bash---su---bash---pstree
| |-bash
| |-gnome-pty-helpe
| `-{gnome-terminal}
|-gnome-vfs-daemo
|-gnome-volume-ma
|-hald---hald-runner-+-hald-addon-acpi
| |-hald-addon-inpu
| `-2*[hald-addon-stor]
|-inetd
|-khelper
|-kirqd
|-klogd
|-ksoftirqd/0
|-ksoftirqd/1
|-kthread-+-aio/0
| |-aio/1
| |-kacpid
| |-kblockd/0
| |-kblockd/1
| |-khubd
| |-kmirrord
| |-kpsmoused
| |-kseriod
| |-kswapd0
| |-2*[pdflush]
| |-reiserfs/0
| |-reiserfs/1
| |-scsi_eh_0
| |-scsi_eh_1
| `-2*[usb-storage]
|-mapping-daemon
|-migration/0
|-migration/1
|-mixer_applet2---{mixer_applet2}
|-mount.ntfs-3g
|-pcscd---{pcscd}
|-portmap
|-realplay---realplay.bin-+-2*[realplay.bin]
| `-8*[{realplay.bin}]
|-rpc.statd
|-syslogd
|-system-tools-ba---dbus-daemon
`-udevd
if you need the command with which the program is invokes use -a & if you need process id (PID) of the process use -p.
you can combine both the commands..
enter and you will see the output as below.
$pstree -ap
init,1
|-NetworkManager,2275 --pid-file /var/run/NetworkManager/NetworkManager.pid
| `-{NetworkManager},2282
|-NetworkManagerD,2283 --pid-file /var/run/NetworkManager/NetworkManagerDispatcher.pid
|-acpid,1846 -c /etc/acpi/events -s /var/run/acpid.socket
|-atd,2352
|-avahi-daemon,2194
| `-avahi-daemon,2195
|-bonobo-activati,3427 --ac-activate --ior-output-fd=16
| `-{bonobo-activati},3430
|-cron,2371
|-cupsd,1888
|-dbus-daemon,1858 --system
|-dbus-daemon,3400 --fork --print-address 25 --print-pid 27 --session
|-dhcdbd,2215 --system
|-epiphany-browse,3494 file:///home/nandam/pstree.html
| `-{epiphany-browse},3496
|-(events/0,6)
|-(events/1,7)
|-exim4,2154 -bd -q30m
|-gconfd-2,3318 14
|-gdm,2308
| `-gdm,2309
| |-Xorg,3321 :0 -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
| `-x-session-manag,3338
| |-gnome-panel,3418 --sm-client-id default1
| |-gnome-settings-,3401
| | `-{gnome-settings-},3404
| |-metacity,3415 --sm-client-id=default0
| |-nautilus,3419 --no-default-window --sm-client-id default2
| |-nm-applet,3434 --sm-disable
| |-seahorse-agent,3390 --execute x-session-manager
| |-ssh-agent,3384 /usr/bin/seahorse-agent --execute x-session-manager
| `-{x-session-manag},3402
|-getty,2387 38400 tty1
|-getty,2388 38400 tty2
|-getty,2389 38400 tty3
|-getty,2390 38400 tty4
|-getty,2391 38400 tty5
|-getty,2392 38400 tty6
|-gnome-keyring-d,3395
|-gnome-screensav,3414
|-gnome-terminal,3525
| |-bash,3530
| | `-pstree,3551 -ap
| |-gnome-pty-helpe,3529
| `-{gnome-terminal},3531
|-gnome-vfs-daemo,3429
|-gnome-volume-ma,3435 --sm-disable
|-hald,2225
| `-hald-runner,2226
| |-hald-addon-acpi,2254
| |-hald-addon-inpu,2246
| |-hald-addon-stor,2260
| `-hald-addon-stor,2262
|-iceape-bin,3503 -edit
| |-{iceape-bin},3507
| |-{iceape-bin},3509
| `-{iceape-bin},3528
|-inetd,2183
|-(khelper,8)
|-(kirqd,282)
|-klogd,1678 -x
|-(ksoftirqd/0,3)
|-(ksoftirqd/1,5)
|-(kthread,9)
| |-(aio/0,137)
| |-(aio/1,138)
| |-(kacpid,15)
| |-(kblockd/0,13)
| |-(kblockd/1,14)
| |-(khubd,542)
| |-(kmirrord,1527)
| |-(kpsmoused,1163)
| |-(kseriod,92)
| |-(kswapd0,136)
| |-(pdflush,134)
| |-(pdflush,135)
| |-(reiserfs/0,735)
| |-(reiserfs/1,736)
| |-(scsi_eh_0,615)
| |-(scsi_eh_1,631)
| |-(usb-storage,628)
| `-(usb-storage,632)
|-mapping-daemon,3448
|-(migration/0,2)
|-(migration/1,4)
|-mixer_applet2,3455 --oaf-activate-iid=OAFIID:GNOME_MixerApplet_Factory --oaf-ior-fd=19
| `-{mixer_applet2},3468
|-mount.ntfs-3g,2558 /dev/sdb1 /media/disk -o rw,nosuid,nodev,uhelper=hal,locale=en_US.UTF-8
|-pcscd,2337
| `-{pcscd},2344
|-portmap,1612
|-rpc.statd,2171
|-syslogd,1669
|-system-tools-ba,2320
| `-dbus-daemon,2321 --session --print-address --nofork
`-udevd,831 --daemon
pstree manual