Tmux

Motivation

At cases, we need to run a long session via SSH for heavy tasks, but the connection is not always stable and might be disconnected. If so, we are going to lose the access to these remote sessions. tmux can help you reconnect to a disconnected remote terminal (if you run these tasks under tmux from the very beginning).

Installation

sudo apt install tmux
sudo apt install tmuxp  # a python session manager for tmux

Usage

tmux

Outside of a session

tmux     # enable tmux in remote terminal before running time-consuming tasks
tmux a   # attach to a previous disconnected terminal launched in tmux
tmux ls  # list all terminals launched by tmux
tmux kill-session -t target-session  # kill a running session
tmux kill-session -a  # kill all sessions
tmux kill-server      # kill all sessions

Inside of a session

To set up mouse scrolling, add the following line to ~/.tmux.conf :

Note that this setting breaks highlighting and copying text. Use shift+click to maintain this functionality.

tmuxp

Reference

Last updated

Was this helpful?