Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
tmux notes and cheatsheet

tmux

it's a terminal multiplexer that allows access to multiple terminal sessions in a single window. so, you can split terminals into panes. you can move, resize, and switch between them.

it's also useful for detaching processes from the controlling terminal. so, a SSH session can remain active without actually being visible. i recommend using tmux if you're doing remote work via ssh.

tmux hotkeys to help with remote ssh dev

install tmux with sudo apt install tmux.

shortcuts:

tmux -V                   # show version
tmux                      # launch tmux
tmux new -s mysessionname # start new session with a name
tmux a -t mysessionname   # attach to a named session
tmux ls                   # show list of tmux sessions
tmux a                    # attach
tmux attach -t 0          # reattach to a running tmux session
tmux kill-session -t 0    # end/kill session
CTRL+B, z                 # toggle current pane full screen
CTRL+B, c                 # add a new window
CTRL+B, n                 # move to next window
CTRL+B, p                 # move to previous window
CTRL+B, ,                 # rename current window
CTRL+B, q                 # show pane numbers
CTRL+B, w                 # list windows and their numbers
CTRL+B, <window number>   # move to window number

panes

CTRL+B, %                 # horizontal split 
CTRL+B, "                 # vertical split 
CTRL+B, d                 # detach from and end session
CTRL+B, x                 # kill the current pane
CTRL+B, o                 # next pane
CTRL+B, {                 # move pane left
CTRL+B, }                 # move pane right
CTRL+B, ;                 # previous pane
CTRL+B, <UP ARROW>        # switch between panes
CTRL+B, <DOWN ARROW>      # switch between panes
CTRL+B, <LEFT ARROW>      # switch between panes
CTRL+B, <RIGHT ARROW>     # switch between panes

scrolling in pane

1. CTRL+B
2. [
3. Arrow keys or Shift + Page up/down
4. Control+C when donw with scrollback

config

don't like CTRL+B binding? you can rebind/remap it. Add set -g prefix C-a to your config.

~/.tmux.conf
tmux source-file ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.