DEV Community

Cover image for Getting Started with tmux
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Getting Started with tmux

This article was originally published on bmf-tech.com.

Overview

An introduction to tmux, a terminal multiplexer.

Key Bindings

Start tmux
tmux or tmux new-session

Create a new session within a session
prefix+:new

List sessions
tmux ls

Detach from a session (exit tmux)
prefix+d

Attach to a session
tmux attach(a)

Attach to a specific session
tmux attach(a) -t 0(name)

Delete a session
tmux kill-session

Delete a specific session
tmux kill-session -t 0

Delete all sessions
tmux kill-server

Rename a session
prefix+$

Create a new window
prefix+c

Switch to the next window
prefix+n

Switch to the previous window
prefix+p

Switch to a specific window
prefix+0

List windows
prefix+w

Delete a window
prefix+&

Delete a pane
prefix+x

Swap panes (forward)
prefix+{

Swap panes (backward)
prefix+}

Copy mode
prefix+[

Select copy range (in copy mode)
v or space

Copy (in copy mode)
y or enter

Tips

When using tmux in macOS Terminal, you cannot copy text by selecting it with the mouse (cmd+c) due to tmux's vim-like shortcuts. To copy the selected range with the mouse, you need to toggle the Terminal's Allow mouse reporting setting with cmd+r.

References

Top comments (0)