Skip to content

Instantly share code, notes, and snippets.

@ecliptik
Created November 11, 2015 17:45
Show Gist options
  • Save ecliptik/158d93f501c38b6581f6 to your computer and use it in GitHub Desktop.
Save ecliptik/158d93f501c38b6581f6 to your computer and use it in GitHub Desktop.
Introduction to Tmux

Introduction to tmux

Show a list of tmux sessions:

  tmux ls
  desk: 3 windows (created Fri Apr  3 09:38:32 2015) [104x30]

Detach from other "desk" session and re-attach, the session will re-configure based on your environment, ie going from portrait to landscape:

  tmux attach -d -t desk

Create a new named session "laptop":

  tmux new-session -s laptop

Basic commands

Split a pane vertically:

  prefix-%

Split a pane horizontally:

  prefix-"

Switch panes with standard bindings:

  prefix-{
  prefix-}

Fullscreen a pane:

  prefix-z

Create a new window:

  prefix-c

Switch to next window:

  prefix-n

Switch to previous window:

  prefix-a

Detach from session:

  prefix-d

Using tmux for sharing

Sharing a new session

Startup new tmux session with a shared socket:

  tmux -S /tmp/share new-session -s share

Change permissions of socket to 777:

  chmod 777 /tmp/share

Have other user log into your system and connect to shared socket:

  tmux -S /tmp/share attach -t share

Sharing an existing session

Find out the session socket in /tmp:

  ls -la /tmp | grep tmux
  drwx------  2 mwaltz users     60 Apr  3 09:38 tmux-69383

Use sudo to attach to the socket:

  sudo tmux -S /tmp/tmux-69383/default attach

Additional References

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