How to rename tmux sessions?

Quick Answer

To rename a tmux session, press Ctrl+b followed by $. You can also use the command tmux rename-session -t old-name new-name from outside tmux.

Ctrl+b+$

Detailed Explanation

Giving your tmux sessions meaningful names helps distinguish between different projects or tasks. You can rename a session either from within tmux or from the command line.

Rename from within tmux:

  1. Press Ctrl+b (the prefix key)
  2. Press $ (dollar sign)
  3. Delete the current name that appears
  4. Type the new session name
  5. Press Enter to confirm

Rename using the command prompt within tmux:

  1. Press Ctrl+b (the prefix key)
  2. Press : (colon) to open the command prompt
  3. Type rename-session new-name
  4. Press Enter to confirm

Rename from outside tmux:

  • tmux rename-session -t current-name new-name
  • tmux rename -t current-name new-name (shorthand)
  • tmux rename-session -t 0 new-name (rename by session number)

Pro Tip

When creating a new session, you can specify the name directly: tmux new-session -s session-name or tmux new -s session-name for short.

Session Names in Status Bar

The session name appears in your tmux status bar by default. You can customize how session names appear in your status bar by modifying the status-left option in your ~/.tmux.conf file.