pkslow.com 南瓜慢说

  • AllArticles
  • Container
  • Spring
  • Life
  • Cloud
  • Collections
  • About
  • GitHub

  • Search
App Terraform101 English Terraform Middleware config Go Private Kubernetes pkslow Test HTTPS Redis Docker Mac Plan Stream MongoDB Spring DevOps JVM String Map Set List Performance Email Springboot JavaCollections ArrayList Java

Mac通过命令pstree显示进程树

Created on: 2021-12-04 | 0 | View: 671

Mac可以通过命令pstree显示进程树。

安装:

$ brew install pstree

帮助文档:

$ pstree --help
pstree: illegal option -- -
pstree $Revision: 2.39 $ by Fred Hucht (C) 1993-2015
EMail: fred AT thp.uni-due.de

Usage: pstree [-f file] [-g n] [-l n] [-u user] [-U] [-s string] [-p pid] [-w] [pid ...]
   -f file   read input from <file> (- is stdin) instead of running
             "ps -axwwo user,pid,ppid,pgid,command"
   -g n      use graphics chars for tree. n=1: IBM-850, n=2: VT100, n=3: UTF-8
   -l n      print tree to n level deep
   -u user   show only branches containing processes of <user>
   -U        don't show branches containing only root processes
   -s string show only branches containing process with <string> in commandline
   -p pid    show only branches containing process <pid>
   -w        wide output, not truncated to window width
   pid ...   process ids to start from, default is 1 (probably init)

Process group leaders are marked with '='.

示例:

通过进程名显示进程树:

$ pstree -s terraform
-+= 00001 root /sbin/launchd
 \-+= 50669 larry /Users/larry/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ ID
   \-+= 51403 larry /bin/bash --rcfile /Users/larry/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213
     \-+= 55301 larry terraform apply
       \--- 55302 larry /Users/larry/Software/terraform/terraform apply

通过进程ID显示进程树,父进程和子进程都会显示:

$ pstree -p 55301
-+= 00001 root /sbin/launchd
 \-+= 50669 larry /Users/larry/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.5744.223/IntelliJ ID
   \-+= 51403 larry /bin/bash --rcfile /Users/larry/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213
     \-+= 55301 larry terraform apply
       \--- 55302 larry /Users/larry/Software/terraform/terraform apply

通过进程ID显示,但只显示它和子进程:

$ pstree 55301
-+= 55301 larry terraform apply
 \--- 55302 larry /Users/larry/Software/terraform/terraform apply

Code for all: GitHub

欢迎关注微信公众号<南瓜慢说>,将持续为你更新...

file

Recommendations:
Cloud Native
Terraform
Container: Docker/Kubernetes
Spring Boot / Spring Cloud
Https
如何制定切实可行的计划并好好执行

  • Author 作者: LarryDpk 南瓜慢说
  • Link 链接: https://www.pkslow.com/archives/mac-pstree
  • 版权声明: 本博客所有文章除特别声明外,不可转载!
# App # Terraform101 # English # Terraform # Middleware # config # Go # Private # Kubernetes # pkslow # Test # HTTPS # Redis # Docker # Mac # Plan # Stream # MongoDB # Spring # DevOps # JVM # String # Map # Set # List # Performance # Email # Springboot # JavaCollections # ArrayList # Java
App Terraform101 English Terraform Middleware config Go Private Kubernetes pkslow Test HTTPS Redis Docker Mac Plan Stream MongoDB Spring DevOps JVM String Map Set List Performance Email Springboot JavaCollections ArrayList Java
各种集合类的合并(数组、List、Set、Map)
解决Kubernetes以root用户mount volumn导致无写权限的问题
  • Contents
  • Site Overview
南瓜慢说

南瓜慢说

多年Java开发,主要专注后端技术:Java/Spring/Springboot/微服务/大数据等。

多读书,多分享;多写作,多整理。

243 Posts
9 Categories
31 Tags
RSS
0%
© 2020 — 2022 南瓜慢说 pkslow The WebSite keeping alive:   粤ICP备20036375号