Chapter 3: The Tmux Prefix Key & Essential Shortcuts
In the previous chapter, you started tmux and saw that it still feels like a normal terminal. You can run commands, work with files, and use your shell just as you normally would.
Now you need a way to tell tmux: "I want you to do something, not my shell." That is what the prefix key does.
Once you understand this one idea, tmux shortcuts stop feeling like a collection of random key combinations. Almost every tmux action follows the same pattern: press the prefix, then choose the action you want.
Prefix key with different actions
What Is the Tmux Prefix?
By default, tmux uses: Ctrl+b as its prefix key.
The prefix is like a signal to tmux: Pay attention. The next key I press is a command for you.
For example, to create a new window, you use: Ctrl+b then c The important part is how you press it. You press: Ctrl+b release both keys, and then press: c So don't think of this as one large keyboard combination.
That two-step pattern is the foundation for the rest of tmux.
Why Does Tmux Need a Prefix?
You might be wondering why tmux cannot simply use keys such as c, n, or z directly. The reason is that those keys already belong to your shell and the programs running inside it.
Imagine you are typing:
cd projectsYou expect your shell to receive those characters.
Tmux cannot treat every c you type as: "Create a new window." That would make normal terminal work impossible. The prefix gives tmux a clean boundary between normal keyboard input and tmux commands.
Without the prefix:
Your keyboard
โ
ShellWith the prefix:
Your keyboard
โ
Ctrl+b
โ
Tmux
โ
Action keySo when you press Ctrl+b tmux knows that the next key has a special meaning. That is why you can continue typing normal Linux commands without tmux constantly getting in the way.
Learn the Shortcut Pattern
The easiest way to learn tmux is not to memorize every shortcut separately.
Learn the pattern first:
Ctrl+b then <key>Then learn what the key represents.
For example:
Ctrl+b then cmeans: Create a new window.
And:
Ctrl+b then dmeans: Detach from the current session.
The prefix stays the same. Only the action key changes.
This is what makes tmux much easier to learn than it initially appears. You are not learning a completely different interface for every feature. You are learning one command pattern and gradually adding actions to it.
The Essential Shortcuts
Let's start with the shortcuts you will use throughout this course.
| Shortcut | Action |
|---|---|
Ctrl+b then c |
Create a new window |
Ctrl+b then n |
Move to the next window |
Ctrl+b then p |
Move to the previous window |
Ctrl+b then , |
Rename the current window |
Ctrl+b then % |
Split the window vertically |
Ctrl+b then " |
Split the window horizontally |
Ctrl+b then z |
Zoom the current pane |
Ctrl+b then d |
Detach from tmux |
You do not need to memorize all of these immediately. Instead, understand what problem each shortcut solves.
You don't have to memorize every tmux binding because tmux can show you its key bindings.
Inside tmux, press:
Ctrl+b then ?tmux available key bindings
Tmux will display a list of available key bindings. That makes learning much less stressful.
If these shortcuts make sense, you're ready for the next step. You now know how to communicate with tmux.
In the next chapter, we'll use these shortcuts to work with sessions, creating named workspaces, detaching from them, finding them again, and reattaching later without losing your work.