格式:pstree 格式:pstree以树状图显示进程PID 为的进程以及子孙进程,如果有-p 参数则同时显 示每个进程的PID。 格式:pstree 以树状图显示进程,相同名称的进程不合并显示,并且会显示命令行参数,如果有-p 参数则同时显示每个进程的PID。 因为pstree 输出的信息可能比较多,所以最好与more/less 配合使用。 使用示例 示例一 [root@web pstreeinit-+-acpid |-atd |-auditd-+-audispd---{audispd} `-{auditd}|-automount---4*[{automount}] |-avahi-daemon---avahi-daemon |-crond---5*[crond-+-mj.sh] `-sendmail]|-cupsd |-dbus-daemon---{dbus-daemon} |-events/0 |-events/1 |-gam_server |-gpm |-hald---hald-runner-+-hald-addon-acpi `-hald-addon-stor|-hcid |-hidd |-hpiod |-java-+-java---17*[{java}] `-14*[{java}]|-java-+-java---29*[{java}] `-14*[{java}]|-java-+-java---34*[{java}] `-14*[{java}]|-java---20*[{java}] |-java---292*[{java}] |-khelper |-klogd |-krfcommd |-ksoftirqd/0 |-ksoftirqd/1 |-kthread-+-aio/0 `-scsi_eh_5|-loop0 |-mcstransd |-migration/0 |-migration/1 |-6*[mingetty] |-mj.sh---make---java---11*[{java}] |-ntpd |-pcscd---{pcscd} |-portmap |-python |-restorecond |-rpc.idmapd |-rpc.statd |-screen---bash---update.sh---cvs |-sendmail---2*[sendmail] |-sendmail |-setroubleshootd---2*[{setroubleshootd}] |-smartd |-sshd-+-sshd---bash---update_and_rest---cvs `-sshd---bash|-start_derby.sh---java---45*[{java}] |-surf---8*[{surf}] |-syslogd |-tomcat---sleep |-udevd |-watchdog/0 |-watchdog/1 |-xfs |-xinetd `-yum-updatesd [root@web 示例二[root@web lessinit(1)-+-acpid(2569) |-atd(2983) |-auditd(2225)-+-audispd(2227)---{audispd}(2232) `-{auditd}(2226)|-automount(2654)-+-{automount}(2655) `-{automount}(2662)|-avahi-daemon(3026)---avahi-daemon(3027) |-crond(2916)-+-crond(14707)-+-mj.sh(14709) `-sendmail(26387)|-cupsd(2717) |-dbus-daemon(2446)---{dbus-daemon}(2447) |-events/0(8) |-events/1(9) |-gam_server(3175) |-gpm(2902) |-hald(2587)---hald-runner(2588)-+-hald-addon-acpi(2596) `-hald-addon-stor(2606)|-hcid(2477) |-hidd(2628) |-hpiod(2676) |-java(1572)-+-java(1586)-+-{java}(1590) 示例三[root@web lessinit |-acpid |-atd |-auditd `-{auditd}|-automount `-{automount}|-avahi-daemon `-avahi-daemon|-crond `-sendmail-FCronDaemon -odi-oem -oi `-sendmail-FCronDaemon -odi-oem -oi `-sendmail-FCronDaemon -odi-oem -oi |-cupsd|-dbus-daemon --system `-{dbus-daemon}|-(events/0) |-(events/1) |-gam_server |-gpm exps2|-hald 示例四[root@web pstree2701 sshd-+-sshd---bash---update_and_rest---cvs |-sshd---bash---pstree `-sshd---bash [root@web 2701sshd(2701)-+-sshd(6745)---bash(6749)---update_and_rest(14193)--- cvs(14194) |-sshd(12626)---bash(12630)---pstree(15588) `-sshd(13324)---bash(13328) [root@web 问题思考相关资料 【1】Linux Operating System How usepstree GEEKSTUFF tree pstree:Visualize Unix Processes HierarchicalStructure 【3】Linux basic configurations Introduction Linuxprocess daemons【4】LINFO pstreeCommand 返回 我使用过的Linux 命令系列总目录