2

For example, in tmux, I name a window 'test', but how can I add the tty of the current terminal (assuming that is pts/15) to the end of window name with the tty command. Then it becomes test pts/15. So it can dynamically show the current tty of the window.

Thanks.

5

Every pane is a tty, of course, if a window contains only one pane, the tty of the pane is the tty of the window, there is a builtin variable in tmux called pane_tty, it is the tty value of the current pane, current here means when you focus on one pane, the value pane_tty you get from tmux is the value of output of tty command in the prompt line in that pane (I think it is the meaning of "dynamically" in your post).

You can use that value like this:

set -g window-status-format '#{pane_tty}'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.