When you SSH into a server, sometimes you need to run a script that takes a long time to execute. You have to keep the connection open while the script is running—otherwise, it might fail (for example, if your internet connection gets disconnected).
tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (so they keep running in the background), and reattach them later.
Here are the common commands I usually use with tmux:
New Session
tmux new -s s1
Detatch Session
Ctrl + b then d
List Session
tmux ls
Attach Session
tmux attach -t s1
Kill Session
tmux kill-session -t s1
Top comments (0)