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 ssh to 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 from inittab(5).
  • --dribble-file dribblename β€” All input from and to the program being run is copied into dribblename (if unspecified, it is discarded).
  • --log-file name β€” Status messages (client connects, disconnects, errors) are sent to name (if unspecified, they go to standard error).
  • --pid-file pidname β€” The process ID of detachtty is written to pidname. See SIGNALS.
  • socket-path β€” The unix-domain socket. If access to command should be in any way restricted, so should this socket β€” i.e. it is recommended that you put it in a mode 700 directory. πŸ”’
  • command arguments β€” 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 to socket-path, or a "remote path" of the form username@host:socket-path where username@host is passed to ssh. The latter form is currently an alias for ssh -t username@host attachtty socket-path [text] and lets ssh manage 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 from detachtty. For local sockets, the same effect can be obtained with (echo -e textΒ΄\rΒ΄; sleep timeout) | attachtty socket-path
  • timeout β€” The maximum timeout in seconds (defaults to 1) 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 SIGHUP to the process identified by pidname will cause detachtty to close and reopen its log files.
  • Sending SIGTSTP to an attachtty process (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 SIGQUIT to an attachtty process (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 ⭐

screen(1), ssh(1), sbcl(1).


πŸ‘‘ 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 πŸ«Άβœ¨πŸ’–