Skip to main content

Chapter 5: Windows - Organize Your Work Inside a Session

In the previous chapter, you learned how to create, name, detach, and reattach tmux sessions.

Now you already have the main workspace. But imagine you're working on a project and need to do several things at once.

You want one terminal for your application, another for logs, another for Git commands, and another for testing. You could open four separate terminal windows.

Or, you can keep everything inside the same tmux session. That's where windows come in.

A tmux window is essentially a terminal tab inside a session. Once you understand sessions, windows are the next layer of organization.

What Is a Tmux Window?

Remember the hierarchy from Chapter 1:

Session
   โ”‚
   โ”œโ”€โ”€ Window
   โ”œโ”€โ”€ Window
   โ””โ”€โ”€ Window

A session represents the overall context. Windows represent the different tasks inside that context. For example, imagine you're working on an application called my-api.

You could have: my-api: (editor, server, logs, git), which will look like below in tmux:

multiple windows in a session

All four windows belong to the same my-api session. This is useful because everything related to the project stays together.

Create a New Window

Let's create one. Inside your tmux session, press:

Ctrl+b c

Remember the prefix sequence:

  1. Press Ctrl+b
  2. Release the keys
  3. Press c
0:00
/0:18

new window creation in tmux

A new window appears. You are now working inside that new window. You can run any normal commands here.

The important part is that you haven't created a new session. You've simply created another workspace inside the same session.

Switch Between Windows

Once you have multiple windows, you need a way to move between them.

Use:

Ctrl+b n

This moves to the next window.

To move to the previous window:

Ctrl+b p

You can also jump directly to a window by its number.

For example:

Ctrl+b 2

takes you to window 2.

And:

Ctrl+b 1

takes you to window 1.

You can see below how the star pointer changes when we change windows:

0:00
/0:13

Switching between windows in tmux

This is one reason the numbers shown in the tmux status bar are useful.

Rename a Window

The default window name is usually based on the process running inside it.

For example, you might see:

0:bash

That's not very descriptive.

Let's give the window a useful name.

Press:

Ctrl+b ,

Tmux will ask you for a new name.

For example:

editor

Press Enter.

Your status bar should now show something similar to:

1:editor

Now you immediately know what that window is for.

0:00
/0:13

renaming a window in tmux

Good names make a big difference once you have several windows.

Close a Window

When you're finished with a window, you can close it by exiting the shell running inside it:

exit

If that is the only shell in the window, the window closes.

You can also use the tmux command:

Ctrl+b &

Tmux will ask you to confirm before killing the current window.

0:00
/0:16

Closing a window in tmux

Be careful with this command because closing a window also closes the processes running inside it.

For example, if a server is running in that window, closing the window will terminate that server process.

So think of it this way:

Create window โ†’ Start work
Close window  โ†’ Finish that workspace

All of these windows are still part of the same session. That means you can detach from the session and later reattach your windows will still be there. This is the combination that makes tmux powerful.

Practice

โœ๏ธ
Try This:
Spend a few minutes switching between your windows without looking at the shortcut table. The goal isn't perfect memorization yet; it's becoming comfortable moving around your tmux workspace.

Create a session called:

tmux new -s practice

Create three windows and name them:

commands
logs
monitoring

Practice moving between them. Then detach:

Ctrl+b d

and reattach:

tmux attach -t practice

Your windows should still be exactly where you left them. You now know how to organize different tasks using windows. But sometimes switching between windows isn't enough.

What if you want to see your application logs and run commands at the same time? Instead of creating another window, you can split the current window into multiple terminal areas.

Those are called panes. In the next chapter, we'll create, navigate, resize, and zoom panes!

Updated on Sep 4, 2026