mirror of
https://github.com/jbranchaud/til
synced 2026-01-14 04:28:02 +00:00
Add Show Tree View Of Processes And Subprocesses as a Unix TIL
This commit is contained in:
@@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/).
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter).
|
||||
|
||||
_1726 TILs and counting..._
|
||||
_1727 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
|
||||
@@ -1756,6 +1756,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Show A File Preview When Searching With FZF](unix/show-a-file-preview-when-searching-with-fzf.md)
|
||||
- [Show Disk Usage For The Current Directory](unix/show-disk-usage-for-the-current-directory.md)
|
||||
- [Show The Size Of Everything In A Directory](unix/show-the-size-of-everything-in-a-directory.md)
|
||||
- [Show Tree View Of Processes And Subprocesses](unix/show-tree-view-of-processes-and-subprocesses.md)
|
||||
- [Skip Paging If Output Fits On Screen With Less](unix/skip-paging-if-output-fits-on-screen-with-less.md)
|
||||
- [SSH Escape Sequences](unix/ssh-escape-sequences.md)
|
||||
- [SSH With Port Forwarding](unix/ssh-with-port-forwarding.md)
|
||||
|
||||
36
unix/show-tree-view-of-processes-and-subprocesses.md
Normal file
36
unix/show-tree-view-of-processes-and-subprocesses.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Show Tree View Of Processes And Subprocesses
|
||||
|
||||
Though you can cobble together a command on a MacOS Unix system to output a
|
||||
hierarchical tree view of a parent process and its descendent subprocesses, it
|
||||
is easier to [`brew install pstree`](https://github.com/FredHucht/pstree) and
|
||||
use that.
|
||||
|
||||
Here is what I see when I run it for a _pid_ that corresponds to a `tmux`
|
||||
session that I have running locally:
|
||||
|
||||
```bash
|
||||
❯ pstree 61690
|
||||
-+= 61690 lastword tmux new-session -d -s TIL -c /Users/lastword/dev/jbranchaud/til
|
||||
|--= 63081 lastword /bin/zsh
|
||||
|-+= 11428 lastword zsh
|
||||
| \-+= 48511 lastword pstree 61690
|
||||
| \--- 48512 root ps -axwwo user,pid,ppid,pgid,command
|
||||
|-+= 62345 lastword zsh
|
||||
| \--= 06031 lastword claude
|
||||
|--= 62364 lastword /bin/zsh
|
||||
|-+= 62373 lastword zsh
|
||||
| \--= 64407 lastword ssh my-app-staging
|
||||
|-+= 61115 lastword /bin/zsh
|
||||
| \-+= 61579 lastword overmind start -f Procfile.dev
|
||||
| \--- 61586 lastword tmux -C -L overmind-my-app-abc123 new -n web -s my-app -P -F %overmind-process #{pane_id} web #{pane_pid} /var/folders/zc/abc123/T/overmin
|
||||
|--= 52237 lastword /bin/zsh
|
||||
|--= 82608 lastword /bin/zsh
|
||||
\--= 10796 lastword /bin/zsh
|
||||
```
|
||||
|
||||
I was looking for a frozen `claude` process that was part of this session. And I
|
||||
found it about halfway down that list -- `06031`. Now I can run `kill` on that
|
||||
process as needed.
|
||||
|
||||
For some additional context, I initially found the _pid_ for the `tmux` session
|
||||
by running `ps aux | grep tmux` and looking through those results.
|
||||
Reference in New Issue
Block a user