About Using Tmux for Time-consuming Scripts on Remote Servers

Using tmux you can start a time-consuming command on a remote server and leave it running while closing the SSH connection.

Install it on a remote Ubuntu Linux server with:

$ apt-get install tmux

Start a new tmux session with:

$ tmux

Then start any time-consuming script or command. While it's running, detach the session with:

Ctrl + b, d

Now you can log out or exit the SSH connection. After a while, reconnect to the server and reattach to the running session with:

$ tmux attach

To exit the tmux session completely, type:

$ exit

Alternatively, use Screen.

Tips and Tricks Dev Ops Developer Experience Bash SSH Tmux