brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tmux list-panes -a -F lists every pane on the server with its folder and command

Tmux
~/tips/tip-tmux-list-panes-all-format

tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_current_command} #{pane_current_path}'

Prints one line per pane on the whole tmux server, in a format you choose.

With more than a few sessions open, I lose track of which pane runs what and where. tmux prints that overview in one command, and I choose what each line looks like.

list-panes normally shows the panes of the current window. With -a it ignores the target and lists all panes on the server, and -F sets the format of each line.

tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_current_command} #{pane_current_path}'

You get one line per pane, for example:

main:1.0 vim /home/me/project
main:2.0 zsh /home/me
logs:1.0 tail /var/log

The first column is a valid pane target, so you can pass it on to commands like tmux send-keys -t main:2.0 or tmux select-pane -t main:2.0.

Two more flags help on a busy server. -f takes a filter and only shows panes for which it is true. -O sets the sort order to one of name, index, size, creation or activity, and -r reverses it.

tmux list-panes -a -O activity -F '#{pane_current_command} #{pane_current_path}'

The manual describes pane_current_command and pane_current_path as “if available”. They depend on what your operating system lets tmux read, so an empty column on an unusual setup does not mean your command is wrong.

Further reading: tmux manual

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link