1dtach(1) General Commands Manual dtach(1)
2
3
4
6 dtach - simple program that emulates the detach feature of screen.
7
9 dtach -a <socket> <options>
10 dtach -A <socket> <options> <command...>
11 dtach -c <socket> <options> <command...>
12 dtach -n <socket> <options> <command...>
13 dtach -N <socket> <options> <command...>
14 dtach -p <socket>
15
16
18 dtach is a program that emulates the detach feature of screen. It is
19 designed to be transparent and un-intrusive; it avoids interpreting the
20 input and output between attached terminals and the program under its
21 control. Consequently, it works best with full-screen applications such
22 as emacs.
23
24 dtach is intended for users who want the detach feature of screen with‐
25 out the other overhead of screen. It is tiny, does not use many
26 libraries, and stays out of the way as much as possible.
27
28
29 SESSIONS
30 A session in dtach is a single instance in which a program is running
31 under the control of dtach. The program is disassociated from the
32 original terminal, and is thus protected from your original terminal
33 being disconnected for some reason.
34
35 Other instances of dtach can attach themselves to a particular session.
36 Input and output is copied between the program running in the dtach
37 session, and the attached terminals.
38
39 dtach avoids interpreting the communication stream between the program
40 and the attached terminals; it instead relies on the ability of the
41 attached terminals to manage the screen.
42
43 Sessions are represented by Unix-domain sockets in the filesystem. No
44 other permission checking other than the filesystem access checks is
45 performed. dtach creates a master process that monitors the session
46 socket, the program, and any attached terminals.
47
48
49 MODES
50 dtach has several modes of operation. It can create a new session in
51 which a program is executed, or it can attach to an existing session.
52 The first argument specifies which mode dtach should operate in.
53
54 -a Attach to an existing session. dtach attaches itself to the
55 session specified by <socket>. After the attach is completed,
56 the window size of the current terminal is sent to the master
57 process, and a redraw is also requested.
58
59 -A Attach to an existing session, or create a new one. dtach first
60 tries to attach to the session specified by <socket> if possi‐
61 ble. If the attempt to open the socket fails, dtach tries to
62 create a new session before attaching to it.
63
64 -c Creates a new session. A new session is created in which the
65 specified program is executed. dtach then tries to attach
66 itself to the newly created session.
67
68 -n Creates a new session, without attaching to it. A new session is
69 created in which the specified program is executed. dtach does
70 not try to attach to the newly created session, however, and
71 exits instead.
72
73 -N Creates a new session, without attaching to it or daemonizing. A
74 new session is created in which the specified program is exe‐
75 cuted. dtach does not try to attach to the newly created ses‐
76 sion, however, and will stay in the foreground until the program
77 exits.
78
79 -p Copies the contents of standard input to a session. dtach con‐
80 nects to the session specified by <socket>, copies the contents
81 of standard input to the session, and then exits. dtach will not
82 scan the input for a detach character.
83
84
85 OPTIONS
86 dtach has a few options that allow you to modify its behavior. Each
87 attaching process can have separate settings for these options, which
88 allows for some flexibility.
89
90
91 -e <char>
92 Sets the detach character to <char>. When the detach character
93 is pressed, dtach detaches itself from the current session and
94 exits. The process running in the session is unaffected by the
95 detach. By default, the detach character is set to ^\ (Ctrl-\).
96
97
98 -E Disables the detach character. dtach does not try to scan input
99 from the terminal for a detach character. The only way to detach
100 from the session is then by sending the attaching process an
101 appropriate signal.
102
103
104 -r <method>
105 Sets the redraw method to <method>. The valid methods are none,
106 ctrl_l, or winch.
107
108 none disables redrawing completely, ctrl_l sends a Ctrl L char‐
109 acter to the program if the terminal is in character-at-a-time
110 and no-echo mode, and winch forces a WINCH signal to be sent to
111 the program.
112
113 When creating a new session, the specified method is used as the
114 default redraw method for the session. If not specified, the
115 ctrl_l method is used.
116
117
118 -z Disables processing of the suspend key. Normally, dtach will
119 suspend itself when the suspend key is pressed. With this
120 option, the suspend character is sent to the session instead of
121 being handled by dtach.
122
123
125 The following example creates a new session that has the detach charac‐
126 ter and suspend processing disabled. A socket is created in the /tmp
127 directory for the session.
128
129 $ dtach -c /tmp/foozle -Ez bash
130
131 The following example attaches to the /tmp/foozle session if it exists,
132 and if not, creates a new session using /tmp/foozle as the socket for
133 the session. Processing of the suspend character is also disabled for
134 the attach instance.
135
136 $ dtach -A /tmp/foozle -z bash
137
138 The following example attaches to the /tmp/foozle session, using the
139 winch redraw method to redraw the screen.
140
141 $ dtach -a /tmp/foozle -r winch
142
143 The following example creates a new session and sets the default redraw
144 method for the session to the winch redraw method.
145
146 $ dtach -c /tmp/foozle -r winch bash
147
148
150 Ned T. Crigler <crigler@users.sourceforge.net>.
151
152
154 screen(1)
155
156
157
158dtach 0.9 May 2016 dtach(1)