Skip to content

tmux

The problem with ssh sessions is that they are not persistent. Once you lose your internet connection, the ssh session will disconnect and usually all programs started inside the ssh session will terminate.1

tmux2 is a program that helps with that.

Minimalist guide to tmux

  • Log in to a server with ssh
  • see if there are any tmux sessions active:

    tmux list-sessions
    
  • If there are no sessions, start a new one:

    tmux
    
  • Otherwise, attach to an existing session:

    tmux attach
    
  • Run your programs as usual


  1. There are tools such as nohup and disown (or the more modern systemd-run) that can be used to keep a program running even without a ssh connection, but they all share the problem that it is not possible to interact with the program once it has started running. 

  2. A similar program is screen but tmux is allegedly more modern.