Manage terminal workspaces using session naming

Bonnie Eisenman
InstructorBonnie Eisenman

Share this video with your friends

Send Tweet
Published 6 years ago
Updated 4 years ago

It's a lot easier to manage your tmux session when they have sensible names. We'll cover:

  • How to create a new, named tmux session with tmux new -s
  • Rename an existing tmux session using tmux rename-session -t
  • Renaming sessions with C-b $
  • Listing sessions with C-b s

[00:01] Managing your Tmux sessions is a lot easier if they have sensible names. In order to rename a session while you're attached to it, we can do control b $. It will tell you here, "Go ahead. Rename your session."

[00:12] I'm going to rename this to be To-do MVC. Now you can see in the status bar it tells me that I'm in the To-do MVC session. If I had to detach from this session with control b d, and then do tmux ls again. You can see that now the To-do MVC session is properly named.

[00:34] That also means that now I can attach to it and call it with -t and then the session's current name. Now if I want, I can also view the list of sessions from within Tmux. I do that by doing control b and then s. You can see right here we now have this list. If I click zero, it will switch me into that session. Now, detach with control b d.

[00:57] You can also rename sessions from the command line not from within a Tmux session. I'm going to rename my session by typing tmux rename session -d, and then the session name. I'm going to rename session two. I'm going to rename it to Scratch. Now if I run tmux ls, you can see that we have the Scratch session, as well as the To-do MVC session.

[01:19] Lastly, we can create a new session with a name by typing tmux new -s, and then the session name. Now if we view the list of sessions with control b s, you can see we have all three of our newly named sessions available here.

Daksh Gautam
Daksh Gautam
~ 5 years ago

I just wanted to know, if i reboot my computer, will my tmux session persist ?