tmux
tmux is tool that lets you run multiple sub-sessions from one session. It’s good for running simultaneous tasks that each need a terminal window without having to open simultaneous, separate ssh sessions or opening multiple terminal windows.
It also allows terminal sessions to persist even when ssh sessions or terminal windows are closed, whether on purpose or unexpectedly. This is great for installing or updating software, compiling large codebases, or other long tasks where remote connections could be unstable, or where simply window space is precious and you’ve got multiple things going at once.
Steps:
tmux
.ctrl
+ b
then d
to leave the sesssion runningtmux attach
if you have multiple tmux sessions open, you can type
tmux list-sessions
to see which sessions are open. Then, if you want to open a particular one, take the number of the session you want to open, and type
tmux attach -t <num>
where <num>
is the number of the session you want to enter that you got from the list-sessions
response.
sudo apt install -y tmux
create a new session
tmux
leave a session without stopping it: ctrl+b
, then d
list existing sessions
tmux list-sessions
attach to an existing session
tmux attach -t [session-number]