tmux Cheat Sheet

tmux is a terminal multiplexer that allows you to manage multiple terminal sessions within a single window. Here’s a cheat sheet for some common tmux commands:

Session Management

Start a New Session:

tmux

Attach to an Existing Session:

tmux attach-session -t session_name

Detach from the Current Session:

Ctrl-b, d

List Sessions:

tmux list-sessions

Window Management

Create a New Window:

Ctrl-b, c

Switch to the Next Window:

Ctrl-b, n

Switch to the Previous Window:

Ctrl-b, p

Switch to a Specific Window:

Ctrl-b, <window_number>

List Windows:

Ctrl-b, w

Close the Current Window:

Ctrl-b, &

Pane Management

Split Window Horizontally:

Ctrl-b, %

Split Window Vertically:

Ctrl-b, "

Switch to Next Pane:

Ctrl-b, o

Switch to Previous Pane:

Ctrl-b, ;

Toggle Pane Layout:

Ctrl-b, Space

Resize Pane (Adjust to Left):

Ctrl-b, Alt + Left Arrow

Resize Pane (Adjust to Right):

Ctrl-b, Alt + Right Arrow

Resize Pane (Adjust to Top):

Ctrl-b, Alt + Up Arrow

Resize Pane (Adjust to Bottom):

Ctrl-b, Alt + Down Arrow

Zoom In/Out of a Pane:

Ctrl-b, z

Miscellaneous

Rename the Current Session:

Ctrl-b, $

Enter Command Mode:

Ctrl-b, :

Search for Text in Panes:

Ctrl-b, /

Show tmux Help:

Ctrl-b, ?

Copy Mode (Scrolling)

Enter Copy Mode:

Ctrl-b, [

Exit Copy Mode:

q

Search Text in Copy Mode:

/

Copy Text:

  • Enter Copy Mode, move to the desired position, press Space to start selection, move to the end of the text, and press Enter to copy.

This cheat sheet covers some of the basic tmux commands. For more detailed information and advanced features, refer to the official tmux documentation.