Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the purpose of the Linux command pstree

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the function of the Linux command pstree". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the function of the Linux command pstree".

Brief introduction to Command

The pstree command shows the derived relationship between processes in a tree diagram.

[root@centos7 ~] # pstree-bash: pstree: command not found [root@centos7 ~] # yum install psmisc-y syntax format pstree [OPTIONS] option description-a # displays the complete instructions for each program-c # does not use reduced notation-G # uses the column drawing character of the VT100 terminal-h # to list the tree view Specifically indicate that the program now executed-H # the effect of this parameter is similar to specifying the "- h" parameter-l # display tree view in long column format-n # sort with program identification code-p # display program identification code-u # display user name-U # use UTF-8 column drawing characters-V # display version information application example [root@centos7 ~ ] # pstree systemd ─┬─ NetworkManager ─── 2 * [{NetworkManager}] ├─ agetty ├─ auditd ─── {auditd} ├─ chronyd ├─ crond ├─ dbus-daemon ├─ lvmetad ├─ master ─┬─ pickup │ └─ qmgr ├─ polkitd ─── 6 * [{polkitd}] ├─ rsyslogd ─── 2 * [{rsyslogd}] ├─ sshd ─┬─ sshd ─── bash ─┬─ gzip │ │ ├─ more │ │ └─ pstree │ sshd ─── bash ├─ systemd-journal ├─ systemd-logind ├─ systemd-udevd └─ tuned ─── 4 * [{tuned}]

Displays the process ID and process number of all current processes in the system

[root@centos7] # pstree-p systemd (1) ─┬─ NetworkManager (634) ─┬─ {NetworkManager} (656) │ └─ {NetworkManager} (658) ├─ agetty (643) ├─ auditd (600) ─── {auditd} (601) ├─ chronyd (646) ├─ crond ├─ dbus-daemon ├─ lvmetad ├─ master ─┬─ pickup 5692 │ └─ qmgr ├─ polkitd ─┬─ {polkitd} │ ├─ {polkitd} 636 │ ├─ {polkitd} │ ├─ {polkitd} │ ├─ {polkitd} │ └─ {polkitd} ├─ rsyslogd ─┬─ {rsyslogd} │ └─ {rsyslogd} ├─ sshd (5304) ─── bash (5306) ─┬─ gzip (5328) │ │ ├─ more (5329) │ │ └─ pstree (6204) │ └─ sshd (5546) ─── bash (5548) ├─ systemd-journal (484) ├─ systemd-logind (├─ systemd-udevd) └─ tuned (872) ─┬─ {tuned} (1131) ├─ {tuned} (1132) ├─ {tuned} (1134) └─ {tuned} (1138)

Displays the details of all processes, and the same process name can be compressed.

[root@centos7] # pstree-a systemd--switched-root-system-deserialize 22 ├─ NetworkManager-no-daemon │ └─ 2* [{NetworkManager}] ├─ agetty-noclear tty1 linux ├─ auditd │ └─ {auditd} ├─ chronyd ├─ crond-n ├─ dbus-daemon-system-- address=systemd:-- nofork-nopidfile-systemd-activation ├─ lvmetad-f ├─ Master-w │ ├─ pickup-l-t unix-u │ └─ qmgr-l-t unix-u ├─ polkitd-no-debug │ └─ 6 * [{polkitd}] ├─ rsyslogd-n │ └─ 2* [{rsyslogd}] ├─ sshd-D │ ├─ sshd │ │ └─ bash │ bash │ │ ├─ gzip-cd mysql _ backup.tar.gz │ │ ├─ more │ │ └─ pstree-a │ └─ sshd │ └─ bash ├─ systemd-journal ├─ systemd-logind systemd-udevd └─ tuned-Es / usr/sbin/tuned-l-P └─ 4 * [{tuned}]

View the PID of the specified process

[root@centos7] # pstree-p | grep ssh |-sshd (868)-+-sshd (5304)-bash (5306)-+-grep (6325) | `- sshd (5546)-- bash (5548) [root@centos7 ~] # pstree-p | grep system systemd (1)-+-NetworkManager (634)-+-{NetworkManager} (6325) |-systemd-journal (484) | |-systemd-logind |-systemd-udevd (509) Thank you for reading | The above is the content of "what is the function of Linux command pstree". After the study of this article, I believe you have a deeper understanding of what the role of Linux command pstree is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report