Skip to content

Instantly share code, notes, and snippets.

@herrera-ignacio
Last active March 12, 2020 19:59
Show Gist options
  • Save herrera-ignacio/f9461d82e25c2ea8c39aaaac079ab2ad to your computer and use it in GitHub Desktop.
Save herrera-ignacio/f9461d82e25c2ea8c39aaaac079ab2ad to your computer and use it in GitHub Desktop.
tmux guide

Sessions

tmux new -s <session_name>
tmux ls
tmux attach -t <session_name>

Hit LEADER + d to detach from session.

Delete a session with tmux kill-session -t <session_name>.

Command Key LEADER

This leader key is your gateway to run any tmux shortcut.

By default bound to CTRL-B, but tmux has a config file and you can rebind it.

Windows

Inside of each session, you can have 1 or more windows.

You can create new window by pressing LEADER + c, and you can name them with LEADER + ,

You can cycle between them like this:

  • next - LEADER + n
  • previous - LEADER + p
  • specific - LEADER + <num>

You can list all windows, and select with arrows and enter, with LEADER + w

You can delete any window with exit command or CTRL + d

Panes

You can split a window in multiple independent terminals.

  • LEADER + %
  • LEADER + "

You can cycle through panes:

  • LEADER + o
  • LEADER + q + <numb>

Zoom in/out a pane

  • LEADER + z

Kill a pane

  • LEADER + x

Scrolling up in the buffer

Press LEADER + [ + arrow or page keys. You can exit with ESC.

Copy / Paste

  • Enter LEADER + [ for copy mode
  • Hit CTRL + SPACE for select mode and select with arrow keys in all directions
  • Hit ALT + w to copy
  • LEADER + ] to paste the selection

Clocks and Cheat sheets

  • Clock with LEADER + t
  • Combo cheat sheets with LEADER + ?

My .tmux.conf

# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment