dtach - A program that emulates the detach feature of screen
dtach is a tiny program that emulates the detach feature of screen,
allowing you to run a program in an environment that is protected from
the controlling terminal and attach to it later. dtach does not keep
track of the contents of the screen, and thus works best with programs
that know how to redraw themselves.
dtach does not, however, have the other features of screen, such as its
support of multiple terminals or its terminal emulation support. This
makes dtach extremely tiny compared to screen, making it more easily
audited for bugs and security holes, and also allows it to fit in
environments where space is limited, such as on rescue disks.
dtach has many possible uses, even though it is tiny. With dtach, you can:
- Attach multiple times to the same program. Access to the dtach session is
controlled through the Unix filesystem permissions; thus, you can
trivially allow other people to watch your session.
- Run a program in an environment that is protected from the controlling
terminal. This means that, for instance, the program running under dtach
would not be affected by the terminal being disconnected for some reason.
- Run programs such as emacs, which tend to want full control
over the terminal. dtach mostly acts as a relay, and does not mangle the
text between the application and your terminal.
- Suspend dtach without suspending the running program. dtach can
handle the suspend key itself instead of passing it to the running
program, which may be useful for certain programs such as ircII.
The latest version of dtach is version 0.8, which you can fetch
Other download formats may be available at the sourceforge
download area for dtach.
The changes in version 0.8 are:
The changes in version 0.7 are:
- When using dtach -A or dtach -c, the master will now wait until the client
attaches before trying to read from the program being executed. This avoids
a race condition when the program prints something and exits before the
client can attach itself.
- Instead of exiting quietly, dtach will now report any errors that occur
while trying to execute the program.
- dtach -n can now be used without a terminal.
- dtach -A will now try to detect and remove stale sockets.
- Removed a Linux-specific escape sequence from the code that restores the
original terminal settings.
- Changed dtach.1 to use \- for the dashes in command line options, and
fix an ambiguous backslash.
- Use non-blocking mode in the master process, and avoid data loss by ensuring
that at least one attaching client succesfully completes a write.
- Fix -e ^<char> to work with lowercase characters.
The changes in version 0.6 are:
- The redraw method can now be explicitly specified on the command line
(either no redraw at all, the old ^L character method, and the new WINCH
signal method), since many programs only handle one or the other properly.
- Changed the default redraw method back to the old ^L character method.
- Changed the attach code to check the return value of select more carefully.
- Changed the SIGWINCH handler to reinstall itself, to handle systems that
always reset the handler.
- Added more proper process group handling.
The changes in version 0.5 are:
- Redraws are now handled by sending the child process a WINCH signal instead
of by sending a ^L character. This should help prevent line-oriented
programs (such as bash) from clearing the screen excessively.
- Flow control is now disabled when setting raw mode on the terminal.
- Switched to using select instead of poll.
- Changed some exits to exit succesfully instead of non-sucessfully.
- Updated my email address.
- Updated to Autoconf 2.59, renaming some files in the process.
The changes in version 0.4 are:
- Fix fd leakage.
- Prevent atexit from being called twice on dtach -A.
The changes in version 0.3 are:
- Slightly improved README and dtach.1
- Portability updates thanks to sourceforge's compile farm. dtach should now
work on: FreeBSD, Debian/alpha, Debian/sparc, Debian/PPC, and Solaris.
You can also obtain information on how to access the CVS tree
here, and access
the sourceforge project page
- Fixed a typo in dtach.1
- Changed the attach code so that it tells the master when a suspend occurs.
- Decreased the client <-> master packet size.
- Changed the master to send a stream of text to attaching clients instead
of sending a huge packet all the time.
- Use getrlimit and dynamically allocate the data structures, if possible.
- Added some more autoconf checks.
- Initial sourceforge release.
You can send any comments or questions about dtach to the author. Comments and
suggestions are welcome.
dtach is Copyright © 2004-2008 Ned T. Crigler, and is under the GNU General