🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

tmux Command

Intermediate Process Management man(1)

Terminal multiplexer with session management

👁 13 views 📅 Updated: Mar 15, 2026
SYNTAX
tmux [COMMAND]

What Does tmux Do?

tmux (terminal multiplexer) creates persistent terminal sessions with multiple panes and windows. It is the modern replacement for screen, offering better split-pane support, configuration, and scripting.

tmux allows you to create sessions with multiple windows, split windows into panes, detach and reattach sessions, and customize every aspect of the interface. Sessions survive SSH disconnection.

tmux is essential for developers and administrators who work on remote servers, need multiple terminal views simultaneously, or want persistent workspaces across SSH sessions.

Options & Flags

OptionDescriptionExample
new -s Create a named session tmux new -s work
attach -t Attach to existing session tmux attach -t work
ls List all sessions tmux ls
kill-session Kill a session tmux kill-session -t work
split-window Split current pane tmux split-window -h
send-keys Send keys to a session (scripting) tmux send-keys -t work 'make build' Enter

Practical Examples

#1 Start named session

Creates a new tmux session named "project".
$ tmux new -s project

#2 Detach

Detaches from the session, leaving it running.
$ Ctrl+B then D
Output: [detached (from session project)]

#3 List sessions

Shows all active tmux sessions.
$ tmux ls
Output: project: 3 windows (created Mon Jan 1 12:00:00 2024)

#4 Reattach

Reconnects to the project session.
$ tmux attach -t project

#5 Split panes

Splits the current window into panes for side-by-side work.
$ Ctrl+B then % (vertical)\nCtrl+B then " (horizontal)

#6 Scripted session setup

Creates a session with vim on the left and a shell on the right.
$ tmux new -d -s dev && tmux send-keys -t dev 'vim .' Enter && tmux split-window -t dev -h && tmux attach -t dev

Tips & Best Practices

Essential shortcuts: Ctrl+B is the prefix. D=detach, C=new window, N=next window, P=previous, %=split vertical, "=split horizontal, arrow=switch pane.
Customize in .tmux.conf: Create ~/.tmux.conf for custom key bindings, mouse support, and appearance. Many people remap the prefix from Ctrl+B to Ctrl+A.
Prefix key collision: Default prefix Ctrl+B conflicts with some terminal apps. Set a custom prefix in .tmux.conf: set-option -g prefix C-a

Frequently Asked Questions

How do I start and detach from a tmux session?
Start: tmux new -s name. Detach: Ctrl+B then D. Reattach later: tmux attach -t name.
How do I split the screen?
Ctrl+B then % for vertical split. Ctrl+B then " for horizontal split. Ctrl+B then arrow keys to switch between panes.
What is the difference between tmux and screen?
tmux has better pane splitting, configuration (.tmux.conf), and scripting. screen is older and more widely available. tmux is generally preferred.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →