如何查看Linux进程树

There are few ways to view process tree in Linux. The most common one is to useps, and add f to the option, which stands for forest

$ ps auxf

Here's a sample output for the command;

root       765  0.0  0.1  18776  3252 ?        Ssl  Jul14   0:00 gdm-binary
root       872  0.0  0.1  20492  3772 ?        Sl   Jul14   0:00  \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root       891  1.1  1.4  37948 29264 tty7     Ss+  Jul14   9:49      \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LCpZat/database -nolisten tcp vt7
root      1127  0.0  0.1  18808  3068 ?        Sl   Jul14   0:00      \_ /usr/lib/gdm/gdm-session-worker
shakir    1522  0.0  0.3  25876  6688 ?        Ssl  Jul14   0:01          \_ gnome-session
shakir    1556  0.0  0.0   3280   356 ?        Ss   Jul14   0:00              \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
shakir    1581  0.0  0.6 114832 13444 ?        Sl   Jul14   0:08              \_ metacity
shakir    1588  0.0  0.2  18396  6048 ?        S    Jul14   0:00              \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
shakir    1590  0.0  0.4  36052  9748 ?        S    Jul14   0:00              \_ bluetooth-applet
shakir    1591  0.0  0.6  56000 13372 ?        S    Jul14   0:01              \_ nm-applet --sm-disable
shakir    1592  0.0  0.9 121140 18836 ?        Sl   Jul14   0:06              \_ gnome-power-manager
shakir    1593  0.0  0.9  72436 18648 ?        S    Jul14   0:01              \_ nautilus
shakir    1594  0.0  0.7  44604 16336 ?        S    Jul14   0:06              \_ gnome-panel
shakir    1680  0.0  0.3  18908  7176 ?        S    Jul14   0:00              \_ /usr/lib/gnome-disk-utility/gdu-notification-daemon
shakir    1729  0.0  0.5  42796 10984 ?        Sl   Jul14   0:00              \_ /usr/lib/evolution/2.28/evolution-alarm-notify
shakir    1730  0.0  0.7  31468 15196 ?        S    Jul14   0:00              \_ python /usr/share/system-config-printer/applet.py
shakir    1810  0.0  0.5  38024 11576 ?        S    Jul14   0:02              \_ update-notifier
root       774  0.0  0.1  18868  3928 ?        Ssl  Jul14   0:00 NetworkManager
root      4008  0.0  0.0   2228  1008 ?        S    09:52   0:00  \_ /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-bnep0.pid -lf /var/lib/dhcp3/dhclient-bba9d47d-f0fa-4a09-b519-86d827efedc3-bne
avahi      777  0.0  0.0   3036  1568 ?        S    Jul14   0:01 avahi-daemon: running [herugrim.local]
avahi      783  0.0  0.0   2924   544 ?        Ss   Jul14   0:00  \_ avahi-daemon: chroot helper

There's a program in Linux that's created just for this purpose, which is pstree. To use it just issue the following command;

$ pstree

And you should get something like this;

init─┬─NetworkManager─┬─dhclient
     │                └─{NetworkManager}
     ├─acpid
     ├─apache2───10*[apache2]
     ├─atd
     ├─avahi-daemon───avahi-daemon
     ├─bluefish
     ├─bluetoothd
     ├─bonobo-activati───{bonobo-activat}
     ├─clock-applet
     ├─console-kit-dae───63*[{console-kit-da}]
     ├─cron
     ├─cupsd
     ├─2*[dbus-daemon]
     ├─2*[dbus-launch]
     ├─firefox───run-mozilla.sh───firefox-bin─┬─plugin-containe───3*[{plugin-contain}]
     │                                        └─14*[{firefox-bin}]
  • How to view running processes in Linux
  • How to view running processes from a particular user in Linux
- See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf

There are few ways to view process tree in Linux. The most common one is to useps, and add f to the option, which stands for forest

$ ps auxf

Here's a sample output for the command;

root       765  0.0  0.1  18776  3252 ?        Ssl  Jul14   0:00 gdm-binary
root       872  0.0  0.1  20492  3772 ?        Sl   Jul14   0:00  \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root       891  1.1  1.4  37948 29264 tty7     Ss+  Jul14   9:49      \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LCpZat/database -nolisten tcp vt7
root      1127  0.0  0.1  18808  3068 ?        Sl   Jul14   0:00      \_ /usr/lib/gdm/gdm-session-worker
shakir    1522  0.0  0.3  25876  6688 ?        Ssl  Jul14   0:01          \_ gnome-session
shakir    1556  0.0  0.0   3280   356 ?        Ss   Jul14   0:00              \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
shakir    1581  0.0  0.6 114832 13444 ?        Sl   Jul14   0:08              \_ metacity
shakir    1588  0.0  0.2  18396  6048 ?        S    Jul14   0:00              \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
shakir    1590  0.0  0.4  36052  9748 ?        S    Jul14   0:00              \_ bluetooth-applet
shakir    1591  0.0  0.6  56000 13372 ?        S    Jul14   0:01              \_ nm-applet --sm-disable
shakir    1592  0.0  0.9 121140 18836 ?        Sl   Jul14   0:06              \_ gnome-power-manager
shakir    1593  0.0  0.9  72436 18648 ?        S    Jul14   0:01              \_ nautilus
shakir    1594  0.0  0.7  44604 16336 ?        S    Jul14   0:06              \_ gnome-panel
shakir    1680  0.0  0.3  18908  7176 ?        S    Jul14   0:00              \_ /usr/lib/gnome-disk-utility/gdu-notification-daemon
shakir    1729  0.0  0.5  42796 10984 ?        Sl   Jul14   0:00              \_ /usr/lib/evolution/2.28/evolution-alarm-notify
shakir    1730  0.0  0.7  31468 15196 ?        S    Jul14   0:00              \_ python /usr/share/system-config-printer/applet.py
shakir    1810  0.0  0.5  38024 11576 ?        S    Jul14   0:02              \_ update-notifier
root       774  0.0  0.1  18868  3928 ?        Ssl  Jul14   0:00 NetworkManager
root      4008  0.0  0.0   2228  1008 ?        S    09:52   0:00  \_ /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-bnep0.pid -lf /var/lib/dhcp3/dhclient-bba9d47d-f0fa-4a09-b519-86d827efedc3-bne
avahi      777  0.0  0.0   3036  1568 ?        S    Jul14   0:01 avahi-daemon: running [herugrim.local]
avahi      783  0.0  0.0   2924   544 ?        Ss   Jul14   0:00  \_ avahi-daemon: chroot helper

There's a program in Linux that's created just for this purpose, which is pstree. To use it just issue the following command;

$ pstree

And you should get something like this;

init─┬─NetworkManager─┬─dhclient
     │                └─{NetworkManager}
     ├─acpid
     ├─apache2───10*[apache2]
     ├─atd
     ├─avahi-daemon───avahi-daemon
     ├─bluefish
     ├─bluetoothd
     ├─bonobo-activati───{bonobo-activat}
     ├─clock-applet
     ├─console-kit-dae───63*[{console-kit-da}]
     ├─cron
     ├─cupsd
     ├─2*[dbus-daemon]
     ├─2*[dbus-launch]
     ├─firefox───run-mozilla.sh───firefox-bin─┬─plugin-containe───3*[{plugin-contain}]
     │                                        └─14*[{firefox-bin}]

Related

  • How to view running processes in Linux
  • How to view running processes from a particular user in Linux
- See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf

There are few ways to view process tree in Linux. The most common one is to useps, and add f to the option, which stands for forest

$ ps auxf

Here's a sample output for the command;

root       765  0.0  0.1  18776  3252 ?        Ssl  Jul14   0:00 gdm-binary
root       872  0.0  0.1  20492  3772 ?        Sl   Jul14   0:00  \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root       891  1.1  1.4  37948 29264 tty7     Ss+  Jul14   9:49      \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LCpZat/database -nolisten tcp vt7
root      1127  0.0  0.1  18808  3068 ?        Sl   Jul14   0:00      \_ /usr/lib/gdm/gdm-session-worker
shakir    1522  0.0  0.3  25876  6688 ?        Ssl  Jul14   0:01          \_ gnome-session
shakir    1556  0.0  0.0   3280   356 ?        Ss   Jul14   0:00              \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
shakir    1581  0.0  0.6 114832 13444 ?        Sl   Jul14   0:08              \_ metacity
shakir    1588  0.0  0.2  18396  6048 ?        S    Jul14   0:00              \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
shakir    1590  0.0  0.4  36052  9748 ?        S    Jul14   0:00              \_ bluetooth-applet
shakir    1591  0.0  0.6  56000 13372 ?        S    Jul14   0:01              \_ nm-applet --sm-disable
shakir    1592  0.0  0.9 121140 18836 ?        Sl   Jul14   0:06              \_ gnome-power-manager
shakir    1593  0.0  0.9  72436 18648 ?        S    Jul14   0:01              \_ nautilus
shakir    1594  0.0  0.7  44604 16336 ?        S    Jul14   0:06              \_ gnome-panel
shakir    1680  0.0  0.3  18908  7176 ?        S    Jul14   0:00              \_ /usr/lib/gnome-disk-utility/gdu-notification-daemon
shakir    1729  0.0  0.5  42796 10984 ?        Sl   Jul14   0:00              \_ /usr/lib/evolution/2.28/evolution-alarm-notify
shakir    1730  0.0  0.7  31468 15196 ?        S    Jul14   0:00              \_ python /usr/share/system-config-printer/applet.py
shakir    1810  0.0  0.5  38024 11576 ?        S    Jul14   0:02              \_ update-notifier
root       774  0.0  0.1  18868  3928 ?        Ssl  Jul14   0:00 NetworkManager
root      4008  0.0  0.0   2228  1008 ?        S    09:52   0:00  \_ /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-bnep0.pid -lf /var/lib/dhcp3/dhclient-bba9d47d-f0fa-4a09-b519-86d827efedc3-bne
avahi      777  0.0  0.0   3036  1568 ?        S    Jul14   0:01 avahi-daemon: running [herugrim.local]
avahi      783  0.0  0.0   2924   544 ?        Ss   Jul14   0:00  \_ avahi-daemon: chroot helper

There's a program in Linux that's created just for this purpose, which is pstree. To use it just issue the following command;

$ pstree

And you should get something like this;

init─┬─NetworkManager─┬─dhclient
     │                └─{NetworkManager}
     ├─acpid
     ├─apache2───10*[apache2]
     ├─atd
     ├─avahi-daemon───avahi-daemon
     ├─bluefish
     ├─bluetoothd
     ├─bonobo-activati───{bonobo-activat}
     ├─clock-applet
     ├─console-kit-dae───63*[{console-kit-da}]
     ├─cron
     ├─cupsd
     ├─2*[dbus-daemon]
     ├─2*[dbus-launch]
     ├─firefox───run-mozilla.sh───firefox-bin─┬─plugin-containe───3*[{plugin-contain}]
     │                                        └─14*[{firefox-bin}]

Related

  • How to view running processes in Linux
  • How to view running processes from a particular user in Linux
- See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf

There are few ways to view process tree in Linux. The most common one is to useps, and add f to the option, which stands for forest

$ ps auxf

Here's a sample output for the command;

root       765  0.0  0.1  18776  3252 ?        Ssl  Jul14   0:00 gdm-binary
root       872  0.0  0.1  20492  3772 ?        Sl   Jul14   0:00  \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root       891  1.1  1.4  37948 29264 tty7     Ss+  Jul14   9:49      \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LCpZat/database -nolisten tcp vt7
root      1127  0.0  0.1  18808  3068 ?        Sl   Jul14   0:00      \_ /usr/lib/gdm/gdm-session-worker
shakir    1522  0.0  0.3  25876  6688 ?        Ssl  Jul14   0:01          \_ gnome-session
shakir    1556  0.0  0.0   3280   356 ?        Ss   Jul14   0:00              \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
shakir    1581  0.0  0.6 114832 13444 ?        Sl   Jul14   0:08              \_ metacity
shakir    1588  0.0  0.2  18396  6048 ?        S    Jul14   0:00              \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
shakir    1590  0.0  0.4  36052  9748 ?        S    Jul14   0:00              \_ bluetooth-applet
shakir    1591  0.0  0.6  56000 13372 ?        S    Jul14   0:01              \_ nm-applet --sm-disable
shakir    1592  0.0  0.9 121140 18836 ?        Sl   Jul14   0:06              \_ gnome-power-manager
shakir    1593  0.0  0.9  72436 18648 ?        S    Jul14   0:01              \_ nautilus
shakir    1594  0.0  0.7  44604 16336 ?        S    Jul14   0:06              \_ gnome-panel
shakir    1680  0.0  0.3  18908  7176 ?        S    Jul14   0:00              \_ /usr/lib/gnome-disk-utility/gdu-notification-daemon
shakir    1729  0.0  0.5  42796 10984 ?        Sl   Jul14   0:00              \_ /usr/lib/evolution/2.28/evolution-alarm-notify
shakir    1730  0.0  0.7  31468 15196 ?        S    Jul14   0:00              \_ python /usr/share/system-config-printer/applet.py
shakir    1810  0.0  0.5  38024 11576 ?        S    Jul14   0:02              \_ update-notifier
root       774  0.0  0.1  18868  3928 ?        Ssl  Jul14   0:00 NetworkManager
root      4008  0.0  0.0   2228  1008 ?        S    09:52   0:00  \_ /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-bnep0.pid -lf /var/lib/dhcp3/dhclient-bba9d47d-f0fa-4a09-b519-86d827efedc3-bne
avahi      777  0.0  0.0   3036  1568 ?        S    Jul14   0:01 avahi-daemon: running [herugrim.local]
avahi      783  0.0  0.0   2924   544 ?        Ss   Jul14   0:00  \_ avahi-daemon: chroot helper

There's a program in Linux that's created just for this purpose, which is pstree. To use it just issue the following command;

$ pstree

And you should get something like this;

init─┬─NetworkManager─┬─dhclient
     │                └─{NetworkManager}
     ├─acpid
     ├─apache2───10*[apache2]
     ├─atd
     ├─avahi-daemon───avahi-daemon
     ├─bluefish
     ├─bluetoothd
     ├─bonobo-activati───{bonobo-activat}
     ├─clock-applet
     ├─console-kit-dae───63*[{console-kit-da}]
     ├─cron
     ├─cupsd
     ├─2*[dbus-daemon]
     ├─2*[dbus-launch]
     ├─firefox───run-mozilla.sh───firefox-bin─┬─plugin-containe───3*[{plugin-contain}]
     │                                        └─14*[{firefox-bin}]

Related

  • How to view running processes in Linux
  • How to view running processes from a particular user in Linux
- See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf

There are few ways to view process tree in Linux. The most common one is to useps, and add f to the option, which stands for forest

$ ps auxf

Here's a sample output for the command;

root       765  0.0  0.1  18776  3252 ?        Ssl  Jul14   0:00 gdm-binary
root       872  0.0  0.1  20492  3772 ?        Sl   Jul14   0:00  \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1
root       891  1.1  1.4  37948 29264 tty7     Ss+  Jul14   9:49      \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LCpZat/database -nolisten tcp vt7
root      1127  0.0  0.1  18808  3068 ?        Sl   Jul14   0:00      \_ /usr/lib/gdm/gdm-session-worker
shakir    1522  0.0  0.3  25876  6688 ?        Ssl  Jul14   0:01          \_ gnome-session
shakir    1556  0.0  0.0   3280   356 ?        Ss   Jul14   0:00              \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-session
shakir    1581  0.0  0.6 114832 13444 ?        Sl   Jul14   0:08              \_ metacity
shakir    1588  0.0  0.2  18396  6048 ?        S    Jul14   0:00              \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
shakir    1590  0.0  0.4  36052  9748 ?        S    Jul14   0:00              \_ bluetooth-applet
shakir    1591  0.0  0.6  56000 13372 ?        S    Jul14   0:01              \_ nm-applet --sm-disable
shakir    1592  0.0  0.9 121140 18836 ?        Sl   Jul14   0:06              \_ gnome-power-manager
shakir    1593  0.0  0.9  72436 18648 ?        S    Jul14   0:01              \_ nautilus
shakir    1594  0.0  0.7  44604 16336 ?        S    Jul14   0:06              \_ gnome-panel
shakir    1680  0.0  0.3  18908  7176 ?        S    Jul14   0:00              \_ /usr/lib/gnome-disk-utility/gdu-notification-daemon
shakir    1729  0.0  0.5  42796 10984 ?        Sl   Jul14   0:00              \_ /usr/lib/evolution/2.28/evolution-alarm-notify
shakir    1730  0.0  0.7  31468 15196 ?        S    Jul14   0:00              \_ python /usr/share/system-config-printer/applet.py
shakir    1810  0.0  0.5  38024 11576 ?        S    Jul14   0:02              \_ update-notifier
root       774  0.0  0.1  18868  3928 ?        Ssl  Jul14   0:00 NetworkManager
root      4008  0.0  0.0   2228  1008 ?        S    09:52   0:00  \_ /sbin/dhclient -d -sf /usr/lib/NetworkManager/nm-dhcp-client.action -pf /var/run/dhclient-bnep0.pid -lf /var/lib/dhcp3/dhclient-bba9d47d-f0fa-4a09-b519-86d827efedc3-bne
avahi      777  0.0  0.0   3036  1568 ?        S    Jul14   0:01 avahi-daemon: running [herugrim.local]
avahi      783  0.0  0.0   2924   544 ?        Ss   Jul14   0:00  \_ avahi-daemon: chroot helper

There's a program in Linux that's created just for this purpose, which is pstree. To use it just issue the following command;

$ pstree

And you should get something like this;

init─┬─NetworkManager─┬─dhclient
     │                └─{NetworkManager}
     ├─acpid
     ├─apache2───10*[apache2]
     ├─atd
     ├─avahi-daemon───avahi-daemon
     ├─bluefish
     ├─bluetoothd
     ├─bonobo-activati───{bonobo-activat}
     ├─clock-applet
     ├─console-kit-dae───63*[{console-kit-da}]
     ├─cron
     ├─cupsd
     ├─2*[dbus-daemon]
     ├─2*[dbus-launch]
     ├─firefox───run-mozilla.sh───firefox-bin─┬─plugin-containe───3*[{plugin-contain}]
     │                                        └─14*[{firefox-bin}]

Related

  • How to view running processes in Linux
  • How to view running processes from a particular user in Linux
- See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf
There are few ways to view process tree in Linux. The most common one is to use ps, and add f to the option, which stands for forest - See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf

有2中方法:


1, ps auxf

选项中f代表是forest

f = forest




2. pstree



root 765 0.0 0.1 18776 3252 ? Ssl Jul14 0:00 gdm-binaryroot 872 0.0 0.1 20492 3772 ? Sl Jul14 0:00 \_ /usr/lib/gdm/gdm-simple-slave --display-id /org/gnome/DisplayManager/Display1root 891 1.1 1.4 37948 29264 tty7 Ss+ Jul14 9:49 \_ /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-LCpZat/database -nolisten tcp vt7root 1127 0.0 0.1 18808 3068 ? Sl Jul14 0:00 \_ /usr/lib/gdm/gdm-session-workershakir 1522 0.0 0.3 25876 6688 ? Ssl Jul14 0:01 \_ gnome-sessionshakir 1556 0.0 0.0 3280 356 ? Ss Jul14 0:00 \_ /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session gnome-sessionshakir 1581 0.0 0.6 114832 13444 ? Sl Jul14 0:08 \_ metacityshakir 1588 0.0 0.2 18396 6048 ? S Jul14 0:00 \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1shakir 1590 0.0 0.4 36052 9748 ? S Jul14 0:00 \_ bluetooth-appletshakir 1591 0.0 0.6 56000 13372 ? S Jul14 0:01 \_ nm-applet --sm-disableshakir 1592 0.0 0.9 121140 18836 ? Sl Jul14 0:06 \_ gnome-power-managershakir 1593 0.0 0.9 - See more at: http://docs.oseems.com/general/operatingsystem/linux/view-process-tree#sthash.B6BbRTen.dpuf

你可能感兴趣的:(Linux系统学习)