Skip to content

Instantly share code, notes, and snippets.

@douglascrp
Last active November 27, 2018 15:20
Show Gist options
  • Save douglascrp/252e0f1dbe08cccb756a432d2762e2e9 to your computer and use it in GitHub Desktop.
Save douglascrp/252e0f1dbe08cccb756a432d2762e2e9 to your computer and use it in GitHub Desktop.
Tmux cheatsheet
Some basic operations:
Split screen vertically: Ctrlb and Shift5
Split screen horizontally: Ctrlb and Shift"
Toggle between panes: Ctrlb and o (or arrows < > V ^ toward the desired screen)
Close current pane: Ctrlb and x
You can achieve more complex layouts by splitting panes. You can also have multiple windows with panes and switch between them.
Create windows: Ctrlb and c
Switch to next window: Ctrlb and n
Switch to previous window: Ctrlb and p
Destroy current window: Ctrlb and Shift7
Sometimes, when you are working on a remote session through SSH, the connection drops.
In cases like this, you can re-stablish it and re-attach to the tmux session.
List the running sessions:
$ tmux ls
0: 1 windows (created Tue Aug 23 12:39:52 2011) [103x30]
$ tmux attach -t 0
When the window is split in two or more panes, if you want to resize them, switch to the desired pane, and then exec:
Ctrl-B then (pressing Ctrl) + arrow (toward the direction you want it to resize, Up or Down, for example)
In order to let the session running, and go back to the ssh session, use the detach command:
Ctrl-B then "d"
Scroll through the log
Ctrl-B then [. After that, one can use your normal navigation keys to scroll around (eg. Up Arrow or PgDn).
Press q to quit scroll mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment