[NOTE] Updated January 20, 2020. This article may have outdated content or subject matter.
0x00 起源
百家饭内容:常用参数速查
主要用于 Linux 运行常驻命令守护,screen 创建窗口后运行程序,相比 nohub 命令使用上心安理得一些。
如果作为办公多窗口使用,推荐使用 tmux 工具
0x01 快速安装
1
2
3
4
5
| _____
/ ___/_____________ ___ ____
\__ \/ ___/ ___/ _ \/ _ \/ __ \
___/ / /__/ / / __/ __/ / / /
/____/\___/_/ \___/\___/_/ /_/
|
Quick install:
Screen
login as root:
sudo su -
yum -y install screen
start screen
screen
create a new screen
CTRL-A c
go to next screen
CTRL-A n, CTRL-A p
detatch from a screen
CTRL-A d
reattach to screen
sceen -r
list screen
screen -list
Log
CTRL-A H
look for activity
“Ctrl-a” “M”
look for in activity
“Ctrl-a” “_”
0x02 帮助手册
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| Options:
-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.
-list or -ls. Do nothing, just list our SockDir.
-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.
-r 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.00.02 (FAU) 5-Dec-03".
-wipe Do nothing, just clean up SockDir.
-x Attach to a not detached screen. (Multi display mode).
-X Execute <cmd> as a screen command in the specified session.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
| Basic
=====
ctrl a c -> create new window
ctrl a A -> set window name
ctrl a w -> show all window
ctrl a 1|2|3|… -> switch to window n
ctrl a ” -> choose window
ctrl a ctrl a -> switch between window
ctrl a d -> detach window
ctrl a ? -> help
ctrl a [ -> start copy, move cursor to the copy
location, press ENTER, select the chars,
press ENTER to copy the selected
characters to the buffer
ctrl a ] -> paste from buffer
How to start screen
===================
screen –DR -> list of detached screen
screen –r PID -> attach detached screen session
screen –dmS MySession -> start a detached screen session
screen –r MySession -> attach screen session with name MySession
Advanced
========
ctrl a S -> create split screen
ctrl a TAB -> switch between split screens
ctrl a Q -> Kill all regions but the current one.
ctrl a X -> remove active window from split screen
ctrl a O -> logout active window (disable output)
ctrl a I -> login active window (enable output)
|
0x03 场景
待补充
Author
Atman
LastMod
2020-01-20
License
CC BY-NC-ND 4.0 | 本文不带任何官方色彩,最终解释权归本站所有