Linux command
dtach 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
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]
说明
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.
参数
- -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.
FAQ
What is the dtach command used for?
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.
How do I run a basic dtach example?
Run `dtach -c [/tmp/session.sock] [command]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c _socket_ do in dtach?
Create new session and attach.