Skip to content
iD-SIGN
Contact us

Moving Running Processes to Tmux

A simple guide to moving a long-running process from your console to Tmux

1 min readpublished 11/2020

In this article 2 chapters
  1. Installing dependencies
  2. Moving the process

If you have ever started a command in your server console that ran longer than you expected and you already needed to log out, here is a simple way to move the command to Tmux.

Installing dependencies

This guide uses commands that are not usually part of a basic Linux installation. They are easy to install, though – on Debian/Ubuntu it's as simple as this:

bash
apt install tmux reptyr

Moving the process

  1. Suspend the process: press Ctrl+Z
  2. Resume the process in the background: bg
  3. Disown the process: disown %1
  4. Start Tmux: tmux or tmux attach (if you already have a tmux session running)
  5. Find the right PID: ps a | grep <$PROCESS_NAME>
  6. Restore the process in Tmux: reptyr <$PID>

The original procedure is taken from https://www.linkedin.com/pulse/move-running-process-screen-bruce-werdschinski/, and a tmux tutorial (in Czech) can be found, for example, on root.cz

Tags Servers, Linux

Share LinkedIn Facebook

Need more than an article?

A few sentences about what you are dealing with are enough.