Ever started a long process running that you thought wouldn’t take long and then thought “I should have run that in screen”?
Well, thanks to an ingenious programmer, you can actually do that!
The app is called reptyr, is at https://github.com/nelhage/reptyr and there’s a ubuntu ppa here Note: I compiled from scratch as the ppa didn’t seem to work for me.
So, all you need to do is open a terminal (press Ctrl-Z to stop the task if you only have one and don’t want to open a new one), run screen (or tmux etc) and type “reptyr 1234″ where 1234 is the process id (pid) of the program to pull to your current terminal. To get the pid, “ps waux” usually gives all the info you need to identify it.
Useful tip – if you’ve ever been ssh’d into a remote machine and don’t want to break the connection or open a new session just to add a new tunnel, there is a way
Press [return] then ~ then C to get to an ssh prompt, then you can add tunnels as you would at the command line e.g.
Then press [return] to return to the session you were running. Cool trick.
Just discovered this site – some handy little command line snippets there
for example some SCP goodness.
Definitely one I will be using again