Skip to content

Reducing number of terminals and saving terminals with tmux (Linux)

Abailey291 edited this page Feb 18, 2021 · 10 revisions

Note: tmux is installed on the server and all lab machines by default

tmux allows many sessions, each of which can have many windows, and run in the background (allows to save a session)

Note that this means that YOU CANNOT CLOSE THE JUPYTER BROWSER! When using tmux abroad (which we have to over the course of the 2020-202X pandemic), it is useful for processing one's data, but cannot be used as a way to log in, run the code, and then log out of the computer. This is because we are creating a direct link to the main computers

One of the benefits of this is that your terminal sessions within tmux will remain active after you have logged out. This is particularly useful for ensuring that longer term processing continues to run after you have gone to bed. Note that all tmux sessions will be lost if / when the machine reboots.

Install

Note: Not necessary on the lab computers

sudo apt install tmux

For mac users:

brew install tmux

To install homebrew (think open-source java):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

General commands

tmux new -> starts new session

tmux list-sessions

tmux kill-session -t <num_of_sess>

tmux kill-server -> kill all sessions

tmux attach -t <num_of_sess>

shortcuts for other commands (all these start with Ctrl-b, release)

c -> new window

p -> previous window n -> next

d -> disconnect

Clone this wiki locally