dtach

minimal detachable terminal session manager

TLDR

Create new session
$ dtach -c [/tmp/session.sock] [command]
Attach to existing session
$ dtach -a [/tmp/session.sock]
Create session, don't attach
$ dtach -n [/tmp/session.sock] [command]
Attach, create if missing
$ dtach -A [/tmp/session.sock] [command]
Set custom detach key
$ dtach -c [/tmp/session.sock] -e '^a' [command]
Create session with no detach key
$ dtach -c [/tmp/session.sock] -E [command]

SYNOPSIS

dtach [options] socket [command [args]]

DESCRIPTION

dtach provides detachable terminal sessions similar to screen or tmux, but focused solely on the detach/attach functionality. It creates a Unix socket for session communication.The minimalist approach makes dtach lighter than alternatives when only session detachment is needed, without window management or other features.

PARAMETERS

-c socket

Create new session and attach.
-n socket
Create new session without attaching.
-a socket
Attach to existing session.
-A socket
Attach or create if missing.
-r method
Redraw method (none, ctrl_l, winch).
-e char
Set detach character.
-E
Disable detach character.
-z
Disable suspend key handling.

INSTALL

sudo apt install dtach
sudo dnf install dtach
sudo apk add dtach
sudo zypper install dtach
brew install dtach
nix profile install nixpkgs#dtach

CAVEATS

No window management. No scrollback buffer. Socket files persist after session ends. Single client at a time by default. No built-in session listing.

HISTORY

dtach was created by Ned T. Crigler in 2001 as a minimal alternative to GNU Screen. It emerged from the desire for session detachment without screen's complexity. The tool is useful when combining with other terminal multiplexers or for simple session persistence.

SEE ALSO

screen(1), tmux(1), abduco(1), nohup(1)