Options: -4 Resolve hostnames only to IPv4 addresses. -6 Resolve hostnames only to IPv6 addresses. -a Force all capabilities into each window's termcap. -A -[r|R] Adapt all windows to the new display width & height. -c file Read configuration file instead of '.screenrc'. -d (-r) Detach the elsewhere running screen (and reattach here). -dmS name Start as daemon: Screen session in detached mode. -D (-r) Detach and logout remote (and reattach here). -D -RR Do whatever is needed to get a screen session. -e xy Change command characters. -f Flow control on, -fn = off, -fa = auto. -h lines Set the size of the scrollback history buffer. -i Interrupt output sooner when flow control is on. -l Login mode on (update /var/run/utmp), -ln = off. -ls [match] or -list Do nothing, just list our SockDir [on possible matches]. -L Turn on output logging. -m ignore $STY variable, do create a new screen session. -O Choose optimal output rather than exact vt100 emulation. -p window Preselect the named window if it exists. -q Quiet startup. Exits with non-zero return code if unsuccessful. -Q Commands will send the response to the stdout of the querying process. -r [session] Reattach to a detached screen process. -R Reattach if possible, otherwise start a new session. -s shell Shell to execute rather than $SHELL. -S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>. -t title Set title. (window's name). -T term Use term as $TERM for windows, rather than "screen". -U Tell screen to use UTF-8 encoding. -v Print "Screen version 4.01.00devel (GNU) 2-May-06". -wipe [match] Do nothing, just clean up SockDir [on possible matches]. -x Attach to a not detached screen. (Multi display mode). -X Execute <cmd> as a screen command in
时间: 2025-06-24 07:43:31 浏览: 18
### Screen 命令选项详细说明
#### `-A`
将所有视窗调整为当前终端机的大小。这有助于解决不同分辨率下的显示问题[^1]。
#### `-d [SCREEN]`
将指定的 `screen` 作业离线化(detach)。如果未提供具体参数,则默认分离最近的一个 `screen` 会话[^2]。
#### `-h [LINES]`
指定视窗缓冲区的行数,允许用户自定义历史记录保存的最大行数[^3]。
#### `-r [SCREEN]`
恢复已离线化的 `screen` 作业。当存在多个可恢复的会话时,可以通过 `[pid.tty.host]` 的形式精确匹配目标会话[^1]。
#### `-R [SCREEN]`
尝试优先恢复最后一个离线的 `screen` 会话;如果没有找到任何可用的离线会话,则自动创建一个新的 `screen` 实例[^2]。
#### `-s [SHELL]`
指定在新打开的窗口中运行的 shell 类型,默认情况下使用系统的默认 shell[^3]。
#### `-S [NAME]`
创建新的 `screen` 会话并为其分配一个唯一的名称,便于区分和管理多个并发会话。
#### `-v`
打印 `screen` 工具的版本号信息[^2]。
#### `-x [SCREEN]`
重新连接到某个已经处于附加状态的 `screen` 会话,允许多个客户端同时访问同一个会话。
#### `-ls | -list`
列出当前系统中存在的所有活动 `screen` 会话列表,帮助管理员快速定位所需资源。
#### `-wipe`
扫描整个系统内的所有 `screen` 进程,并移除那些不再有效的僵尸会话实例[^3]。
#### `-t [TITLE]`
设置或更改特定屏幕窗口的标题栏文字内容,提高多任务环境下的辨识度[^2]。
#### `-m`
即便已经有正在运行中的 `screen` 服务,仍然强制启动另一个全新的独立实例[^3]。
---
### 示例代码展示
以下是通过命令行创建带命名的新 `screen` 会话以及查看现有会话的方法:
```bash
# 创建名为 "my_session" 的新 screen 会话
screen -S my_session
# 列出所有现有的 screen 会话
screen -ls
```
---
###
阅读全文
相关推荐










