I'm scripting Tmux, and would like to know the number of panes in the current window from a bash script.

Is there anyway to find out this information?

in pseudo code, i'd like something like this:

COUNT=$(tmux get_number_of_panes)

1 Answer 1


Might be a better way, but

tmux list-panes | wc -l


  • 8
    In one command: tmux display-message -p '#{window_panes}' (see the FORMATS section of the man page for other variables). Feb 24, 2015 at 5:55
  • @ChrisJohnsen Right on. Easy to miss because it's not in the pane_ group
    – Steven Lu
    Jan 30, 2017 at 20:15

You must log in to answer this question.

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