Create session with a name

tmux new -s <name>

Create detached session with a name

This particular example will run SimpleHTTPServer in the background:

tmux new -s python -d 'python -m SimpleHTTPServer'

To kill it programatically:

kill -9 `top -n 1 | pgrep tmux`

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 ~ .


Use tmuxinator for environment automation

Great tutorial here:

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


Show Help Menu

C-b C-/

Scroll up

Type this command in:

ctrl-b [

At this point you can use things like your arrow keys and page up/page down, etc.


Screen splitting

Horizontal split:

ctrl-b "

Vertical split:

ctrl-b %

Change direction of split:

ctrl-b <space bar>


Change starting dir of new tmux session

  1. Detach from the tmux session
  2. Run this command:
tmux attach-session -t <tmux session name> -c <new starting dir>