> ## Content Index
> Fetch the complete content index at: https://linuxhandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Rename a Session in Tmux
- URL: https://linuxhandbook.com/tmux-rename-session/
- Published: 2024-12-05T10:38:40.000Z
- Updated: 2024-12-05T10:42:43.000Z
- Description: Better to name your tmux sessions so that it easy to identify and organize them.
- Author: Pranav Krishna
- Tags: Exploring Tmux, #docs-col

Your productivity will increase by many folds if you can organise tmux the right way. Well, tmux sessions are the right way to do so.

The first step to organising these sessions is naming them appropriately, based on what processes they manage. 

This is the [continuation of the tmux series](https://linuxhandbook.com/tmux/), right from [attaching and detaching sessions](https://linuxhandbook.com/tmux-attach-detach-session/). 

## Rename a session outside tmux

By default, tmux creates sessions just like it indexes all its panes and windows with numbers (from 0). 

When you are in the command line outside tmux, you can still perform operations on sessions. This can come in handy when you are automating session creation itself - using scripts or configs.

To know what session to rename, check the ongoing sessions by running the command 

```bash
tmux ls

```

![List of all sessions in tmux](https://linuxhandbook.com/content/images/2024/11/tmux-ls-2.png)

List of all sessions in tmux

To rename a session, you can use the following command:

```bash
tmux rename-session -t <target-session> <new-name>
```

where `<target-session>` is the current name, probably a number, of the session to be renamed. 

![Rename sessions outside tmux](https://linuxhandbook.com/content/images/2024/11/tmux-rename-session-outside.gif)

Rename sessions outside tmux

## Rename a session within tmux

You can rename it while already in a session by the following shortcut:

```
[Ctrl+B] + $
```

Here's an example of how to do the same:

![Rename a session within tmux](https://linuxhandbook.com/content/images/2024/11/tmux-rename-session-within-1.gif)

Rename a session within tmux

## Conclusion

Renaming your tmux sessions is a simple but powerful step toward keeping your terminal environment organized and efficient. Proper session names help you quickly identify and switch between different tasks.

When you are done with a session, it might make sense to terminate it. The next one in this series deals with how you can kill sessions.