Tmux Cheatsheet

Create session with a name

tmux new -s <name>

Attach to session with name

tmux attach -t <name>

List sessions

tmux ls
# or from within a tmux session:
ctrl+b s

Background session

ctrl+b d

Rename current session

ctrl+b $

Kill session

tmux kill-session -t <name>

Background session on remote host and close ssh session

return ~ .

Resources

https://gist.github.com/henrik/1967800

Screen splitting

Horizontal split:

ctrl-b "

Vertical split:

ctrl-b %

Resources:
https://gist.github.com/MohamedAlaa/2961058

Use tmuxinator for environment automation

Great tutorial here: https://collectiveidea.com/blog/archives/2017/03/27/using-tmuxinator-to-automate-your-environment

Use mouse to copy and paste in a pane

In iTerm2:

  1. Hold down the Option key and the alt key
  2. Drag your mouse with the left click to select a body of text in a particular pane

Use Command-c to copy and Command-v to paste

Resource:
https://stackoverflow.com/questions/12287432/how-to-copy-to-system-clipboard-from-tmux-output-after-mouse-selection