Skip to main content
Browse referenceAll guides
Back to Commands
Window ManagementPrefix + s

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

bash
tmux choose-tree [-GNrswZ] [-F format] [-f filter] [-K key-format] [-O sort-order] [-t target-pane] [template]

Options

FlagDescription
-sStart with sessions collapsed (show sessions only)
-wStart with windows collapsed
-ZZoom the pane while the tree is open
-O sort-orderSort order: 'index', 'name', or 'activity'
-f filterOnly show items matching a filter format

Examples

Open the session/window tree

bash
tmux choose-tree

Open showing sessions only

bash
tmux choose-tree -s

Bind a zoomed window picker

bash
bind w choose-tree -Zw

In .tmux.conf: Prefix + m opens a window picker, and the chosen window swaps places with the current one.

bash
bind m choose-tree -Zw "swap-window -t '%%'"

A window picker limited to the api session.

bash
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