# reptyr: Attach a running process to a new terminal

DevFeed: [reptyr: Attach a running process to a new terminal](<https://devfeed.tech/articles/reptyr-attach-a-running-process-to-a-new-terminal-21927.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/2011/01/reptyr-attach-a-running-process-to-a-new-terminal/>)

Author: Nelson Elhage

Published: 2011-01-21T21:56:01Z

Content type: article

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [Terminal](<https://devfeed.tech/topics/terminal.md>), [Processes](<https://devfeed.tech/topics/processes.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [ssh](<https://devfeed.tech/topics/ssh.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [C](<https://devfeed.tech/topics/c.md>)

Tags: [c](<https://devfeed.tech/tags/c.md>), [gdb](<https://devfeed.tech/tags/gdb.md>), [linux](<https://devfeed.tech/tags/linux.md>), [ncurses](<https://devfeed.tech/tags/ncurses.md>), [process](<https://devfeed.tech/tags/process.md>), [ssh](<https://devfeed.tech/tags/ssh.md>), [terminal](<https://devfeed.tech/tags/terminal.md>), [tool](<https://devfeed.tech/tags/tool.md>)

## AI overview

The article introduces reptyr, a utility that attaches an existing running program to a new terminal. It explains how the tool transfers file descriptors, copies terminal settings, changes the process's controlling terminal, and notes limitations involving child processes.

## Source excerpt

Over the last week, I've written a nifty tool that I call reptyr. reptyr is a utility for taking an existing running program and attaching it to a new terminal. Started a long-running process over ssh, but have to leave and don't want to interrupt it? Just start a screen, use reptyr to grab it, and then kill the ssh session and head on home. You can grab the source, or read on for some more details.