In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the usage of Linux basic command pstree". In daily operation, I believe many people have doubts about the usage of Linux basic command pstree. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "the usage of Linux basic command pstree"! Next, please follow the editor to study!
Pstree
Pstree shows the tree structure of the running process, with PID as the root; if pid is omitted, init is the root. If a user name is specified, all process trees rooted in processes owned by that user are displayed. If pstree is called as pstree.x11, it will prompt the user at the end of the line to press RETURE and will not return until this happens. This is very useful for running pstree in an x terminal.
Pstree visually merges the same branches by placing them in square brackets and prefixing them with a repeat count. For example:
Init-+-getty
| |-getty |
| |-getty |
'- getty
Become what it looks like below.
Init---4* [getty]
The child thread of the process is found under the parent process and displays the process name in curly braces, for example:
Icecast2---13* [{icecast2}]
The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
Pstree [options]
2. List of options
Option
Description
-a
Displays the complete instructions for each process, including paths and parameters
A
Display the tree using ascii code
-c
Turn off reduced representation
-G
Draw characters using VT 100line
-h
Highlight the program being executed
-H
Similar to "- h", but highlights the specified process. Unlike-h, pstree fails when using-H if the highlight is not available.
-l
Long format display
-n
Sort by process number, by default by name
-p
Show pid
-u
Show users
-U
Display characters in utf-8
-V
Display command version information
-Z
Context of each SELinux
3. Examples
1) display the completed tree structure
[root@localhost] # pstree-a
Init
├─ NetworkManager-- pid-file=/var/run/NetworkManager/NetworkManager.pid
│ ├─ dhclient- d-4-sf / usr/libexec/nm-dhcp-client.action-pf / var/run/dhclient-eth0.pid...
│ └─ {NetworkManager}
├─ VBoxClient-- clipboard
│ └─ VBoxClient-- clipboard
2) display the process number
[root@localhost] # pstree-p
Init (1) ─┬─ NetworkManager (6362) ─┬─ dhclient (6377)
│ └─ {NetworkManager} (6379)
├─ VBoxClient (7869) ─── VBoxClient (7870) ─── {VBoxClient} (7872)
├─ VBoxClient (7882) ─── VBoxClient (7883)
├─ VBoxClient (7890) ─── VBoxClient (7891) ─── {VBoxClient} (7894)
├─ VBoxClient (7898) ─── VBoxClient (7899) ─┬─ {VBoxClient} (7901)
│ └─ {VBoxClient} (7903)
├─ VBoxClient (7306) ─── VBoxClient (7308)
├─ VBoxClient (7312) ─── VBoxClient (7314) ─── {VBoxClient} (7317)
├─ VBoxClient (7318) ─── VBoxClient (7320) ─┬─ {VBoxClient} (7323)
│ └─ {VBoxClient} (7325)
At this point, the study of "the usage of the Linux basic command pstree" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.