DETACHTTY(1)
π DETACHTTY(1) π
okay bestie, welcome to the DETACHTTY(1) page from your very own General Commands Manual π«Ά sit down, grab a strawberry, we're gonna learn how to run interactive stuff non-interactively and then vibe with it whenever we want β¨
πΈ NAME πΈ
detachtty, attachtty β run an interactive program with io to a unix-domain socket π
β¨ SYNOPSIS β¨
detachtty [--no-detach] [--dribble-file dribblename] [--log-file name]
[--pid-file pidname] socket-path command [arguments-to-command]...
attachtty socket-path [command] [timeout]
attachtty username@host:socket-path [command]
π¦ DESCRIPTION π¦
So like, detachtty lets you run interactive programs non-interactively, and then connect to them (optionally over the network, slay) when you actually do need to interact with them. The command gets run on a pseudo-terminal, and data is copied back and forth between it and a unix(7)-domain socket named socket-path. And heads up: command runs with the current user's permissions and environment variables. no cap π₯
attachtty is the bestie you call when you wanna connect to a process running under detachtty. It copies between socket-path and stdin/out. It also catches SIGINT and arranges for it to be forwarded to the command, so you can use Control-C in the usual fashion, like a normal person π
If you've used screen, it's a similar concept. Compared to screen, detachtty has:
- no capability to swap between different screens (it doesn't co-opt
C-a) π - no tty emulation (you can sanely use it in emacs comint modes) β¨
- no features (less to go wrong) π
- no configuration file π
- ability to spawn
sshto securely connect across the network π
π OPTIONS π
These programs approximately follow the usual GNU command line syntax, using long options that start with two dashes (--). iconic behaviour fr fr
For detachtty, the options are:
--no-detachβ Don't fork into the background. Useful if you wish to start the program frominittab(5).--dribble-filedribblenameβ All input from and to the program being run is copied intodribblename(if unspecified, it is discarded).--log-filenameβ Status messages (client connects, disconnects, errors) are sent toname(if unspecified, they go to standard error).--pid-filepidnameβ The process ID ofdetachttyis written topidname. See SIGNALS.socket-pathβ The unix-domain socket. If access tocommandshould be in any way restricted, so should this socket β i.e. it is recommended that you put it in a mode700directory. πcommandargumentsβ The command to run (which is searched for in the normal way). All remaining command line parameters are passed to it as arguments.
For attachtty, the options are instead:
socket-pathβ This is either the path tosocket-path, or a "remote path" of the formusername@host:socket-pathwhereusername@hostis passed tossh. The latter form is currently an alias forssh -t username@host attachtty socket-path [text]and letssshmanage the authentication, i.e. whether to ask for a password or not. π§textβ The text to write into the socket. It will be processed by the command executed fromdetachtty. For local sockets, the same effect can be obtained with(echo -e textΒ΄\rΒ΄; sleep timeout) | attachtty socket-pathtimeoutβ The maximum timeout in seconds (defaults to1) to wait for the written text to be processed. This is available only for local connections.
To detach from the tty without exiting from the server process, send attachtty any signal that it doesn't catch. See the SIGNALS section. π
π NOTES π
detachtty does not search the user's PATH environment variable for the program to execute, so a full pathname must be provided. yes really, give it the whole thing π
If you get an immediate "Child terminated, exiting" message from detachtty, this usually means that the program you specified was not found or could not be executed (on Linux 2.4, execve(1) succeeds even if it didn't, so to speak). π
You will probably go insane a lot more slowly if you use absolute pathnames for all filename arguments. π
π SIGNALS π
- Sending
SIGHUPto the process identified bypidnamewill causedetachttyto close and reopen its log files. - Sending
SIGTSTPto anattachttyprocess (usually from the keyboard with^Z) will cause it to stop itelf, leaving the server process running. It can be resumed normally with the shell builtin command"fg". - Sending
SIGQUITto anattachttyprocess (usually from the keyboard with^\) will cause it to detach from the tty and quit, leaving the server process running. Sometimes you need to press it twice. π
β SEE ALSO β
π AUTHOR π
Written by Daniel Barlow <dan@telent.net>, and a cast of units. Modified by Luca Capello <luca@pca.it>. Modified by Mark Huetsch <markhuetsch@gmail.com>. Modified by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com>.
okay that's the whole page, you ate that π
this edition is dated Mar 18, 2006 and it's the DETACHTTY(1) one from the General Commands Manual β love u, go detach responsibly π«Άβ¨π
π¦ where this page comes from
- debian bookworm: detachtty 11.0.0-2+b1 Β· GPL-2.0-or-later
- debian trixie: detachtty 11.0.0-2+b1 Β· GPL-2.0-or-later
- ubuntu jammy: detachtty 11.0.0-2build1 Β· GPL-2.0-or-later
- ubuntu noble: detachtty 11.0.0-2build1 Β· GPL-2.0-or-later
- ubuntu resolute: detachtty 11.0.0-2build2 Β· GPL-2.0-or-later
- ubuntu stonking: detachtty 11.0.0-2build2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms