世界都没见过
谈什么世界观

远程登录是自动运行 Screen

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 [ "$PS1" != "" -a "${STARTED_SCREEN:-x}" = x -a "${SSH_TTY:-x}" != x ]
  7. then
  8.   STARTED_SCREEN=1 ; export STARTED_SCREEN
  9.   [ -d $HOME/lib/screen-logs ] || 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. # [end of auto-screen snippet]

新建 ~/.screenrc 文件

  1. # see http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html
  2. # support color X terminals
  3. termcap  xterm ‘XT:AF=\E[3%dm:AB=\E[4%dm:AX’
  4. terminfo xterm ‘XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX’
  5. 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’
  6. termcap  xtermc ‘XT:AF=\E[3%dm:AB=\E[4%dm:AX’
  7. terminfo xtermc ‘XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX’
  8. 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’
  9. # auto-screen support; see http://taint.org/wk/RemoteLoginAutoScreen
  10. # detach on hangup
  11. autodetach on
  12. # no startup msg
  13. startup_message off
  14. # always use a login shell
  15. shell -$SHELL
  16. # auto-log
  17. logfile $HOME/lib/screen-logs/%Y%m%d-%n.log
  18. 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,然后方向键

赞(2) 打赏
未经允许不得转载:VPS排行榜 » 远程登录是自动运行 Screen

相关推荐

  • 暂无文章

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏