Tmux

Kevin FOO
1 min readSep 20, 2024

--

Useful commonly used commands and shortcut keys for tmux.

Installation

# macOS
brew install tmux

# Ubuntu
sudo apt update
sudo apt install tmux -y

Running

# Start a new session
tmux

# Start a new session and give it a name
tmux new -s session_name

# Attach to last used session
tmux a

# Attach to a named session
tmux a -t session_name

# List all sessions
tmux ls

# Rename a session
tmux rename-session -t current_name new_name

# Run a script in a new tmux session and detach it
tmux new -d '/path/to/script.sh'

Within tmux

# New window
Ctrl + b
c

# Next window
Ctrl + b
n

# Previous window
Ctrl + b
p

# Select window 2
Ctrl + b
2

# Close window
Ctrl + d


# Split pane horizontally
Ctrl + b
"

# Split pane vertically
Ctrl + b
%

# Show pane number
Ctrl + b
q

# Choose pane 2
Ctrl + b
q
2

# Navigate pane with arrow keys
Ctrl + b
Arrow keys (left, right, up or down)

# Detach the session
Ctrl + b
d

< Back to all the stories I had written

--

--

Kevin FOO
Kevin FOO

Written by Kevin FOO

A software engineer, a rock climbing, inline skating enthusiast, a husband, a father.

No responses yet