Screen + Reptyr - Steal processes - Unable to find the fd for the pty!

Reptyr is a very useful tool.

With it you can steal processes from other terminals. It is very useful together with screen.

apt install reptyr screen

Open a new terminal, do
ps ax or ps ax|grep <name of process to steal>
reptyr <process id>
Or if it fails, take the terminal:
reptyr <process id> -T

Then do Ctrl + A and d to detach from the screen and let it continue to run.

To re-attach to the screen, do screen -r, if you get a list, do screen -r <screen id>.

Cannot steal terminal twice workaround

If you try to take the whole terminal twice, for example:

reptyr <process id> -T

Then you get "Unable to find the fd for the pty!"

The workaround for this is to find the previous reptyr -T process and refer to that instead:

reptyr <process id-of-previous-reptyr-T-process> -T


This is a personal note. Last updated: 2019-06-22 00:52:46.


Don't forget to pay my friend a visit too. Joakim