zxxx牛人大佬:
按照说明弄成功了,真的很好用。

出处:http://taint.org/wk/RemoteLoginAutoScreen

在 ~/.bashrc 文件开头添加

  1. # Auto-screen invocation. see: http://taint.org/wk/RemoteLoginAutoScreen
  2. # if we’re coming from a remote SSH connection, in an interactive session
  3. # then automatically put us into a screen(1) session.   Only try once
  4. # — if $STARTED_SCREEN is set, don’t try it again, to avoid looping
  5. # if screen fails for some reason.
  6. if
  7. then
  8.   STARTED_SCREEN=1 ; export STARTED_SCREEN
  9.    || mkdir -p $HOME/lib/screen-logs
  10.   sleep 1
  11.   screen -RR && exit 0
  12.   # normally, execution of this rc script ends here…
  13.   echo "Screen failed! continuing with normal bash startup"
  14. fi
  15. #

新建 ~/.screenrc 文件

  1. # see http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html
  2. # support color X terminals
  3. termcap  xterm ‘XT:AF=\E2;:fs=\007:ds=\E]2;screen\007’
  4. termcap  xtermc ‘XT:AF=\E2;:fs=\007:ds=\E]2;screen\007’
  5. # auto-screen support; see http://taint.org/wk/RemoteLoginAutoScreen
  6. # detach on hangup
  7. autodetach on
  8. # no startup msg
  9. startup_message off
  10. # always use a login shell
  11. shell -$SHELL
  12. # auto-log
  13. logfile $HOME/lib/screen-logs/%Y%m%d-%n.log
  14. deflog on

注: 如果你只想要自动运行 Screen 功能,中间的7行是最重要的部分;
如果愿意,您可能可以省略 “color X terminals” 和 “auto-log” 节,也即

~/.screenrc 文件

  1. # auto-screen support; see http://taint.org/wk/RemoteLoginAutoScreen
  2. # detach on hangup
  3. autodetach on
  4. # no startup msg
  5. startup_message off
  6. # always use a login shell
  7. shell -$SHELL

h20牛人大佬:
请教下screen滚走的怎么翻回去看?

zxxx牛人大佬:


请教下screen滚走的怎么翻回去看?

这个真不知道。我的要求就是断线重连恢复现场,就像没有断开一样。

论坛大师牛人大佬:


请教下screen滚走的怎么翻回去看?

Ctrl + A,然后按一下 ESC,然后方向键