63

I'd like to switch directly to a pane in Tmux, by pane #.

How can I do this? I know how to cycle between panes, and move to panes that are beside the current pane.

I'd like to be able to run the display-panes command, which shows the "pane #" on each pane, then later on jump directly to a pane using the pane #'s that were displayed by display-panes.

Is this possible?

NOTE: And just to be clear, I don't mean window, I mean pane. Thanks!

2
  • is there any way to focus the currently highlighted pane using the direction keys to navigate panes? eg I up arrow to be sent to bash and not tmux after the current pane is selected... the timeout drives me crazy Oct 12, 2019 at 20:53
  • none that I know of
    – Brad Parks
    Oct 13, 2019 at 13:09

4 Answers 4

82

You can jump directly to a pane by typing pane's index while it is showed by display-panes command.

From man tmux:

display-panes [-t target-client]
                   (alias: displayp)
             Display a visible indicator of each pane shown by target-client.
             See the display-panes-time, display-panes-colour, and
             display-panes-active-colour session options.  While the indicator
             is on screen, a pane may be selected with the ‘0’ to ‘9’ keys.

Or instead of typing command, you can use:

C-b q
  • C-b send prefix key
  • q display panes indexes
5
  • 16
    If the pane #'s show too quick for you to select a pane, use the following in your .tmux.conf file to change the amount of time the pane #'s are displayed. set display-panes-time 4000 Note that you can hit the esc key to cancel the operation if you want
    – Brad Parks
    Sep 18, 2014 at 12:37
  • Can you also so up and down, right and left instead of using a number? Apr 20, 2017 at 15:14
  • The set display-panes-time 4000 works nicely, however, there is one edge case I hit that is just a minor thing but would be good to know how to get around it. If I have my default shell set to tmux and use guake to launch into it, the first time I get an /home/elynn/.tmux.conf:92: no current session warning. Jun 27, 2018 at 21:37
  • 1
    K, looks like -g works, set -g display-panes-time 4000 Jun 27, 2018 at 21:42
  • Furthermore if you open more than 10 tmux panes, it is not easy or impossible to move a specific pane using C-b <pane #> when the pane index is larger than 10. In that case, C-b <arrow keys> would be useful to navigate panes and move the focus around panes.
    – W.Lee
    Feb 8, 2021 at 7:33
29

Ctrlbq (the tmux default prefix sequence plus q) will briefly display the pane indexes, if you enter the index number while they are displayed, your cursor will move to that pane.

If you have a large number of panes and the display time is too short, you can configure tmux to display the index for a specified interval with the display-panes-time option in your ~/.tmux.conf. The value is in milliseconds.

9

When you know the indicator of your target-pane (e.g. by display-panes), you can directly switch to this pane with select-pane.

From man tmux:

select-pane [-DdegLlMmRU] [-P style] [-T title] [-t target-pane]
                   (alias: selectp)
             Make pane target-pane the active pane in window target-window,
             or set its style (with -P).

Say you want to switch to the pane with the indicator 2, type:

C-b : select-pane -t 2

or the alias

C-b : selectp -t 2
8

I know this isn't necessarily what you asked for, but enabling mouse support is pretty easy and most terminal emulators support it.

You may simply click on the pane you want to switch to. :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .