Skip to main content
tmux is a terminal multiplexer that allows you to run multiple terminal sessions within a single window, making it easier to manage multiple tasks.
1

Update package lists

First, update your package lists:
sudo apt update
2

Install tmux

Install tmux using the apt package manager:
sudo apt install tmux -y
3

Start tmux session

Start a new tmux session:
tmux
You’ll see a new terminal with a status bar at the bottom.
4

Detach session

To detach from the tmux session (keep it running in the background):Press Ctrl+b then d.

Basic tmux commands

Start a named session

tmux new-session -s mysession

List sessions

tmux list-sessions

Attach to existing session

tmux attach-session -t mysession

Create new window

Press Ctrl+b then c

Switch between windows

Press Ctrl+b then window number (0-9)

Split pane horizontally

Press Ctrl+b then "

Split pane vertically

Press Ctrl+b then %

Switch between panes

Press Ctrl+b then arrow keys

Kill session

tmux kill-session -t mysession

tmux configuration

Create a configuration file for custom settings:
touch ~/.tmux.conf
Add common configurations:
# Enable mouse support
set -g mouse on

# Start window numbering at 1
set -g base-index 1

# Start pane numbering at 1
setw -g pane-base-index 1

Next Steps

Now that tmux is installed, you can:
  • Run multiple terminal sessions
  • Keep processes running after disconnecting
  • Organize your work with windows and panes
  • Create persistent development environments

Build docs developers (and LLMs) love