reredirect(1)

πŸ“¦ version 2026-02, in nixos 26.05, nixpkgs unstable

πŸ’… reredirect(1) β€” like, the redirect-your-running-process girly ✨

okay so real talk, this is a page from the General Commands Manual, and it's about the icon that is reredirect. buckle up bestie πŸŽ€


✨ NAME ✨

reredirect β€” the tool that dynamically redirects the outputs of a process that's already running πŸ‘‘ no restart, no relaunch, we just slide in πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

reredirect [-i FILE |-i FD ] [-m FILE |-o FILE |-e FILE |-I FD |-O FD
|-E FD ] [-N] [-d] PID

🌸 DESCRIPTION 🌸

okay so reredirect is this utility that takes a program that is already running and attaches its input/outputs β€” that's standard output and error output, iykyk β€” to files or to another process. literally just vibes-based plumbing 🫢

the simple usage is giving:

reredirect -m FILE PID

and it will redirect the outputs of PID to FILE. slay ✨

you can also redirect standard input, output and error output into different files, which is honestly so main character:

reredirect -i FILE1 -o FILE2 -e FILE3 PID

and just so you know, the -m option is literally just a shortcut to -o FILE -e FILE. that's it. that's the whole thing πŸ’–

after it launches, reredirect gives you a command to restore the state of PID. it will look something like:

reredirect -N -I 4 -O 5 -E 3 5453

and yes β€” -I, -O and -E act like -i, -o and -e but with file descriptors that are already opened in PID. they're only used to restore the previous state of PID, no cap 🧚


πŸ’… OPTIONS πŸ’…

  • -i FILE β€” the file you want to redirect stdin to πŸ“
  • -o FILE β€” the file you want to redirect stdout to πŸ’œ
  • -e FILE β€” the file you want to redirect stderr to 🌈
  • -m FILE β€” same than -o FILE -e FILE, a two-for-one deal πŸ’–
  • -I FD β€” redirect stdin to this file descriptor. mainly used to restore process input πŸ”₯
  • -O FD β€” redirect stdout to this file descriptor. mainly used to restore process outputs ⭐
  • -E FD β€” redirect stderr to this file descriptor. mainly used to restore process outputs πŸ‘‘
  • -N β€” do not save the previous stream, we're moving on bestie πŸ™ˆ
  • -V β€” print the version of reredirect and exit πŸ’«
  • -h β€” print a usage message and exit πŸŽ€
  • -v β€” print verbose debug output while running, for the nosy girlies πŸ”

⚠️ NOTES ⚠️

okay this part matters so pay attention bestie 😭

reredirect depends on the ptrace(2) system call to attach itself to the remote program. and on Ubuntu Maverick and higher, that ability is disabled by default for security reasons. yeah. πŸ’€

you can enable it temporarily by doing:

# echo 0 > /proc/sys/kernel/yama/ptrace_scope

as root, or permanently by editing the file /etc/sysctl.d/10-ptrace.conf, which β€” fun fact β€” also contains more information about this setting πŸ¦‹


πŸ› BUGS πŸ›

bugs should be reported to the author (see below) or via the issue tracker on GitHub. please be nice about it 🫢


πŸ’œ AUTHORS πŸ’œ

reredirect was mainly written by JΓ©rΓ΄me Pouiller <jezz@sysmic.org>. you can contact hom β€” yes, the manpage says "hom", we love a typo moment πŸ’… β€” for any questions or bug reports.

also, reredirect (and especially all the ptrace layer) is based on the reptyr programm (typo number two, iconic). reptyr was written by Nelson Elhage <nelhage@nelhage.com> ✨


🌟 HOMEPAGE 🌟

⟨https://github.com/jerome-pouiller/reredirect⟩


and that's the whole page, bestie πŸŽ€ this gem dropped 26 Aug 2014 with the source/version stamp reredirect(1) β€” go redirect something and live your truth, periodt πŸ’–πŸ‘‘

πŸ“¦ where this page comes from