Linux: Keep Process Running After Ending SSH Session

To remind how to use a cool tool named tmux

Beside the following features the tmux program provides, there are many more.

  • Windows can be moved between session and even linked to multiple sessions
  • Windows can be split horizontally and vertically into panes
  • Support for UTF-8 and 256 colour terminals
  • Sessions can be controlled from the shell without the need to enter a session

A Basic Usage

  1. ssh into the remote machine
  2. start tmux by typing tmux into the shell
  3. start the process you want inside the started tmux session
  4. leave/detach the tmux session by typing Ctrl-B and then D
  5. now, you can safely logoff from the remote machine, your process will keep running inside tmux

After some time…

  1. log back again
  2. use tmux attach to attach to the current tmux session

Multiple sessions? No problem…

  1. running side-by-side you should name each session using Ctrl-B and $.
  2. to get the list of the currently running sessions using tmux list-sessions.

Scrolling

Press Ctrl-b to normally navigate/scroll using the keys (eg. Up/Down Arrows or PgUp/PgDn).

Press q to quit scroll mode.

And that’s pretty much it… (source and source).

Advertisements
This entry was posted in Security, Server. Bookmark the permalink.