Alpine Linux Hostname in Tmux
My tmux setup, as many, includes remote server hostname as part of the “tab” title. As I use ssh to move from server to server, title keeps me informed where exactly I am. Except it doesn’t work with bare Alpine Linux.
The easiest way I got it working again is by adding the following lines after my last PS1 is set. For example, if using very bare setup, adding this line to ~/.profile is sufficient.
PS1='\[\ek\h:\W\]'$PS1This will prefix any PS1 output with a terminal title setup sequence (ESC k). Content here can be whatever, but I like to make it <hostname>:<dir> (\h:\W). This gives me the most information in minimal character count.
Happy tmuxing!