tmux provides a number of commands in the shell such as rename-session which operate on the session that the invoking shell belongs to.

It also provides commands like list-clients which list out the different tmux sessions that are currently running.

I am looking for a command along the lines of tmux pwd which will echo out the name of the tmux session to which my active shell session belongs.

e.g. Inside tmux session foo:

$ tmux pwd

Is there a command for this, or a roundabout way to get it?

1 Answer 1


Try executing this inside your tmux session:

tmux display-message -p '#S'


You must log in to answer this question.

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