Detaching and Attaching Sessions

One of tmux’s biggest advantages is that we can fire it up, start up programs or processes inside the tmux environment, and then leave it running in the background by “detaching” from the session.

If we close a regular terminal session, all the programs we have running in that session are killed off. But when we detach from a tmux session, we’re not actually closing tmux. Any programs we started up in that session will stay running. We can then “attach” to the session and pick up where we left off. To demonstrate, let’s create a new named tmux session, start up a program, and detach from the session. First, we create the session:

 
$ ​tmux new -s basic

Then, within the tmux session, we start an application called ...

Get tmux now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.