Tmux

From Deep Learning Course Wiki
Jump to: navigation, search

tmux allows you to create multiple tabs and panes within a single terminal window. It can also keep programs running after you disconnect (e.g. when you ssh into an AWS instance)

Installation

  • cygwin Recommend to install the same way `wget` was installed from within cygwin installer as in Jeremy's first lecture of the class.

Tutorials

Terms

  • Session - Saved collection of windows and panes and programs you left running inside
  • Attaching - Enter a running session
  • Detaching - Exit a running session (without killing it)
  • Window - Similar to a tab in your browser. Only one window is visible at a time.
  • Pane - Belongs to a window. You can have many of these visible at once.

Commands

Here is a list of the most common commands that will get you 90% of the way there.

Outside Tmux

Typically these are run outside, but you can also run them inside an existing session

Start New Session

 tmux new -s myname

Attach To Existing Session

 tmux a -t myname          #by name 
 tmux a 4                  #by number (in this case 4)

List Sessions

 tmux ls

Kill Session

 tmux kill-session -t myname

Show Tmux Commands

 tmux list-keys | less              #press ‘q’ to exit, arrow keys to navigate

Inside Tmux Session

Start each command with CTRL + b, release, then press one of the following:

Panes

 %                          vertical split
 "                          horizontal split
 d                          detach from session  (it keeps running in the background)
 x                          kill pane
 Up/Down/Left/Right         move between panes
 : + resize-pane -D         Resizes the current pane down
 : + resize-pane -U         Resizes the current pane upward
 : + resize-pane -L         Resizes the current pane left
 : + resize-pane -R         Resizes the current pane right
 : + resize-pane -D 20      Resizes the current pane down by 20 cells

Windows

 c     create window
 w     list windows     #you can also use this to select windows
 n     next window
 p     previous window
 &     kill window
 ,     rename window