DEV Community

Play Button Pause Button
Waylon Walker
Waylon Walker

Posted on • Updated on • Originally published at waylonwalker.com

tmux rename session

So you have been working on your tmux workflow, you've dropped a too many window workflow for scoping work that belongs together into separate sessions, but you cannot remember what session your work is in. If your diligent you have named your window when you created it, but sometimes its intent has changed or your were just plain too lazy at the time for the extra characters needed to name it. Don't worry we can still give that session a descriptive name.

Let's rename some sessions in the terminal.

# rename the current session to me
tmux rename-session me

# rename the me session to scratch
tmux rename-session -t me scratch 
Enter fullscreen mode Exit fullscreen mode

There is a default keybinding that you can use <prefix>+$ to rename the current session in the tmux command line.

bind-key          $ command-prompt -I #S "rename-session '%%'"
Enter fullscreen mode Exit fullscreen mode

I've also had this keybinding kicking around for years, but I rarely use it anymore. You will see why in an upcoming video.

bind -n M-W command-prompt "rename-session '%%'"
Enter fullscreen mode Exit fullscreen mode

Be sure to check out the full YouTube playlist and subscribe if you like it.

tmux playlist on youtub

Also check out this long form post for more about how I use tmux.

Top comments (1)

Collapse
 
raine profile image
Raine Virta • Edited

I've also had this keybinding kicking around for years, but I rarely use it anymore. You will see why in an upcoming video.

So, why? This doesn't mean anything for someone reading the article a year later :)

edit: Found it, he uses this script to open a project and it renames the session automatically to the name of the directory. github.com/WaylonWalker/devtainer/...