Skip to content

Instantly share code, notes, and snippets.

@entrofi
Last active July 9, 2024 06:26
Show Gist options
  • Save entrofi/ed3bda5c00ab902ab731d9fe04a7f4dd to your computer and use it in GitHub Desktop.
Save entrofi/ed3bda5c00ab902ab731d9fe04a7f4dd to your computer and use it in GitHub Desktop.
tmux cheatsheet

Tmux CheatSheet

Session Management

tmux new -s session_name creates a new tmux session named session_name

tmux attach -t session_name attaches to an existing tmux session named session_name

tmux switch -t session_name switches to an existing session named session_name

tmux list-sessions lists existing tmux sessions

tmux detach (prefix + d) detach the currently attached session

tmux rename-session [-t current-name] [new-name] | prefix + $ rename session

Window Management

tmux new-window (prefix + c) create a new window

tmux select-window -t :0-9 (prefix + 0-9) move to the window based on index

tmux rename-window (prefix + ,) rename the current window

tmux list-windows Lists all windows

tmux kill-window (prefix + &) Kill current window

Panes

tmux split-window (prefix + ")

splits the window into two vertical panes

tmux split-window -h (prefix + %)

splits the window into two horizontal panes

tmux swap-pane -[UDLR] (prefix + { or })

swaps pane with another in the specified direction

tmux kill-pane (prefix + x)

Kills the active pane

tmux select-pane -[UDLR]

selects the next pane in the specified direction

tmux select-pane -t :.+

selects the next pane in numerical order

Resizing Panes

Resize pane down

prefix + :resize-pane -D <new_size>

Resize pane up

prefix + :resize-pane -U <new_size>

Resize pane left

prefix + :resize-pane -L <new_size>

Resize pane right

prefix + :resize-pane -R <new_size>

Scroll mode

To turn on scroll mode in a pane

prefix + [

then you can use standard navigation keys

To turn off scroll mode in a pane press q

Resurrect plugin

set -g @plugin 'tmux-plugins/tmux-resurrect'

prefix C + s Save session prefix C+r Restore session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment