Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Manage terminal workspaces using session naming


    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


    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    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."

    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.

    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.

    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.

    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.