1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-14 12:38:01 +00:00

Add List Processes Running Across All Session as a tmux TIL

This commit is contained in:
jbranchaud
2026-01-13 11:24:30 -06:00
parent 81afd44913
commit 35f1f0b807
2 changed files with 48 additions and 1 deletions

View File

@@ -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).
_1727 TILs and counting..._
_1728 TILs and counting..._
See some of the other learning resources I work on:
@@ -1566,6 +1566,7 @@ If you've learned something here, support my efforts writing daily TILs by
- [Kill Other Connections To A Session](tmux/kill-other-connections-to-a-session.md)
- [Kill The Current Session](tmux/kill-the-current-session.md)
- [List All Key Bindings](tmux/list-all-key-bindings.md)
- [List Processes Running Across All Session](tmux/list-processes-running-across-all-sessions.md)
- [List Sessions](tmux/list-sessions.md)
- [Open New Splits To The Current Directory](tmux/open-new-splits-to-the-current-directory.md)
- [Open New Window With A Specific Directory](tmux/open-new-window-with-a-specific-directory.md)

View File

@@ -0,0 +1,46 @@
# List Processes Running Across All Session
I wanted an overview of all the processes running across all the tmux sessions
that I have running on my machine right now. The `list-panes` command (with the
`-a` flag) gives me a listing of all the panes across all session of the current
tmux server.
That output on its own isn't giving me quite the info I'm looking for though.
With the `-f` (_format_) flag, I can use variables available in that context
like `session_name`, `pane_pid`, and `pane_current_command`.
I can assemble the details I want into a command like this:
```bash
tmux list-panes -a -F "#{session_name}:#{window_index}.#{pane_index} #{pane_pid} #{pane_current_command}"
PLP:1.1 62364 zsh
TIL:1.1 62345 nvim
TIL:1.2 65838 task
TIL:2.1 11428 tmux
client-app:1.1 62373 ssh
client-app:1.2 10796 zsh
client-app:1.3 63081 zsh
client-app:2.1 61115 overmind
client-app:3.1 82608 zsh
visualmode-dev:1.1 52237 zsh
```
This gives me the details I want, but I can take it a step further by piping it
to the `column` command to improve the formatting a little:
```bash
tmux list-panes -a -F "#{session_name}:#{window_index}.#{pane_index} #{pane_pid} #{pane_current_command}" \
| column -t
PLP:1.1 62364 zsh
TIL:1.1 62345 nvim
TIL:1.2 65838 task
TIL:2.1 11428 tmux
client-app:1.1 62373 ssh
client-app:1.2 10796 zsh
client-app:1.3 63081 zsh
client-app:2.1 61115 overmind
client-app:3.1 82608 zsh
visualmode-dev:1.1 52237 zsh
```
See `man tmux` and, in particular, the `FORMATS` section for more details.