← 返回命令列表

Linux command

reptyr 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Attach

reptyr [pid]

Example

reptyr $(pidof [htop])

说明

reptyr moves a running process to a new terminal. This is invaluable when you start a long-running command in a regular terminal and later realize it should be in screen or tmux. The tool uses ptrace to reparent the process's controlling terminal, allowing it to receive input from and send output to the new terminal.

参数

-s
Attach via script method (more compatible)
-T
Attach process and its children
-l
List PIDs that can be attached
-v
Verbose output
pid
Process ID to attach

FAQ

What is the reptyr command used for?

reptyr moves a running process to a new terminal. This is invaluable when you start a long-running command in a regular terminal and later realize it should be in screen or tmux. The tool uses ptrace to reparent the process's controlling terminal, allowing it to receive input from and send output to the new terminal.

How do I run a basic reptyr example?

Run `reptyr [pid]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s do in reptyr?

Attach via script method (more compatible)