brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Ctrl-b $ renames the tmux session you are in

Tmux
~/tips/tip-tmux-rename-session

Ctrl-b $

Gives the current tmux session a clearer name without restarting it.

A session called 0 tells you nothing a week later.

Ctrl-b $
# or from a shell
tmux rename-session -t 0 blog

The name shows in square brackets at the left of the status bar and in tmux ls. The same goes for windows with Ctrl-b ,.

With three sessions open, blog, server and work tell you at once where you are, and 0, 1 and 2 do not. The name also appears in the terminal title if you let tmux set it, which helps when you have several terminal windows.

Renaming does not restart anything. All windows, panes and running programs stay as they are, and other terminals attached to the session see the new name straight away. It also works for a detached session from the shell, using the target flag as in the example above.

Names are matched case-sensitively, so Blog and blog are different sessions.

Try it without risk: start a throwaway session with tmux new -s scratch, use the shortcut or command above there, look at what changes, and close the session again with tmux kill-session -t scratch.

Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official), On this site: tmux new -As work attaches to a session or creates it, On this site: tmux kill-session -a closes every session except the one you name

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link