choose-tree
Open an interactive tree of sessions, windows, and panes to preview and choose one. This is the picker behind the default Prefix + s (sessions) and Prefix + w (windows) bindings.
How choose-tree works
choose-tree opens an interactive tree of every session, window, and pane, with a live preview. It powers two default keys: Prefix + s opens it with sessions collapsed, and Prefix + w opens it with windows collapsed. Both zoom the pane while the tree is open.
Move with the arrow keys and press Enter to go to the selected item. Each line also has a shortcut key in brackets for an instant jump. Other useful keys: x kills the selected item after a confirmation, t tags items, : runs a command for each tagged item, f filters, Ctrl+s searches by name, v toggles the preview, O changes the sort order, and q quits.
You can change what happens on Enter by giving a template. tmux replaces %% with the chosen target and runs the result. Without a template it runs switch-client -t '%%'.
Synopsis
tmux choose-tree [-GNrswZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]Options
| Flag | Description |
|---|---|
| -s | Start with sessions collapsed (show sessions only) |
| -w | Start with windows collapsed |
| -Z | Zoom the pane while the tree is open |
| -O sort-order | Sort order: 'index', 'name', or 'activity' |
| -f filter | Only show items matching a filter format |
Examples
Open the session/window tree
tmux choose-treeOpen showing sessions only
tmux choose-tree -sBind a zoomed window picker
bind w choose-tree -ZwIn .tmux.conf: Prefix + m opens a window picker, and the chosen window swaps places with the current one.
bind m choose-tree -Zw "swap-window -t '%%'"A window picker limited to the api session.
tmux choose-tree -Zw -f '#{==:#{session_name},api}'Default Keybinding
Prefix + s (sessions), Prefix + w (windows)
Default prefix is Ctrl+b
Common Mistakes
- It only works when at least one client is attached, so it is not useful from a background script.
- x kills a whole session or window, not just the preview. Read the confirmation prompt before pressing y.
- A filter that would hide everything is ignored, so a typo in -f can look like the filter did nothing.
Pro Tips
- •Type to filter, then press Enter to select
- •Use O to change the sort order inside the tree