HANDBOOK
远程登录是自动运行 Screen
出处:http://taint.org/wk/RemoteLoginAutoScreen 在 ~/.bashrc 文件开头添加
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen # if we’re coming from a remote SSH connection, in an interactive session # then automatically put us into a screen(1) session. Only try once # — if $STARTED_SCREEN is set, don’t try it again, to avoid looping # if screen fails for some reason. if [ "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" != x ] then STARTED_SCREEN=1 ; export STARTED_SCREEN [ -d $HOME/lib/screen-logs ] || mkdir -p $HOME/lib/screen-logs sleep 1 screen -RR && exit 0 # normally, execution of this rc script ends here… echo "Screen failed! continuing with normal bash startup" fi # [end of auto-screen snippet] |
新建 ~/.screenrc 文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# see http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html # support color X terminals termcap xterm ‘XT:AF=\E[3%dm:AB=\E[4%dm:AX’ terminfo xterm ‘XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX’ termcapinfo xterm ‘XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX:hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007’ termcap xtermc ‘XT:AF=\E[3%dm:AB=\E[4%dm:AX’ terminfo xtermc ‘XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX’ termcapinfo xtermc ‘XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX:hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007’ # auto-screen support; see http://taint.org/wk/RemoteLoginAutoScreen # detach on hangup autodetach on # no startup msg startup_message off # always use a login shell shell -$SHELL # auto-log logfile $HOME/lib/screen-logs/%Y%m%d-%n.log deflog on |
注: 如果你只想要自动运行 Screen 功能,中间的7行是最重要的部分; 如果愿意,您可能可以省略 “color X terminals” 和 “auto-log” 节,也即 ~/.screenrc 文件
1 2 3 4 5 6 7 |
# auto-screen support; see http://taint.org/wk/RemoteLoginAutoScreen # detach on hangup autodetach on # no startup msg startup_message off # always use a login shell shell -$SHELL |
请教下screen滚走的怎么翻回去看? Ctrl + A,然后按一下 ESC,然后方向键