Ever wished you could split your terminal into panes, keep sessions alive after SSH disconnects, or switch between projects lightning fast? Meet tmux
. Whether you're managing servers, coding in the CLI, or just want better multitasking, tmux
can massively boost your productivity.
What is tmux
?
tmux
(Terminal MUltipleXer) is a command-line tool that lets you:
- Split your terminal into multiple panes
- Run multiple windows in one terminal session
- Keep your work running even if your SSH session dies
- Switch between projects quickly
- Customize keybindings and workflows
Installing tmux
On macOS:
brew install tmux
On Ubuntu/Debian:
sudo apt install tmux
Start with the Basics
tmux
You’re inside a tmux
session.
Now let’s learn how to use it.
Understanding the "Prefix"
Most tmux shortcuts start with a prefix key.
Default prefix = Ctrl + b
That means when you see a shortcut like:
Ctrl + b, then c
It means:
- Hold
Ctrl
and pressb
- Release both
- Press
c
Remember step 2 always, beginners often make the mistake of not releasing the buttons, like i did back when i started :)
Essential tmux Shortcuts
Here are the most useful tmux
shortcuts you'll actually use.
Window Management
Shortcut | What It Does |
---|---|
Ctrl+b c |
Create a new window |
Ctrl+b n |
Next window |
Ctrl+b p |
Previous window |
Ctrl+b w |
List all windows |
Ctrl+b & |
Close current window |
Windows are like tabs — each has its own terminal instance.
Pane Management (splitting windows)
Shortcut | What It Does |
---|---|
Ctrl+b " |
Split window horizontally |
Ctrl+b % |
Split window vertically |
Ctrl+b o |
Switch to next pane |
Ctrl+b ; |
Go to last active pane |
Ctrl+b x |
Kill the current pane |
Ctrl+b z |
Toggle zoom (full-screen a pane) |
Session Management
Sessions are like "workspaces" you can detach and reattach to.
Shortcut/Command | What It Does |
---|---|
tmux new -s mysession |
Start a new named session |
Ctrl+b d |
Detach from session |
tmux ls |
List sessions |
tmux attach -t mysession |
Reattach to a named session |
tmux kill-session -t mysession |
Kill a session |
This is gold when working with remote servers — disconnect safely and come back later.
Wrapping Up
tmux
might feel a bit weird at first, but once you get used to it, it’s like having superpowers inside your terminal.
If you:
- SSH into servers
- Use the terminal for coding
- Want to never lose your work again
…then give tmux
a try.
Cheat Sheet Summary
tmux # start a session
tmux new -s name # new named session
tmux ls # list sessions
tmux attach -t name # reattach
Ctrl+b c # new window
Ctrl+b n / p # next/prev window
Ctrl+b % / " # split vertical / horizontal
Ctrl+b o # move between panes
Ctrl+b d # detach session
If you're a software developer who enjoys exploring different technologies and techniques like this one, check out LiveAPI. It’s a super-convenient tool that lets you generate interactive API docs instantly.
So, if you’re working with a codebase that lacks documentation, just use LiveAPI to generate it and save time!
You can instantly try it out here! 🚀