基本使用

SSH时可以方便地resume工作

 # open new screen session
screen
# restore
# -d: use the -d option to detach the screen session from the terminal where it's in.
# https://unix.stackexchange.com/questions/240444/cant-resume-screen-says-i-am-already-attached
screen -rd <session_number>

Steps Using GNU Screen

  1. Connect. Connect to a remote server and create a Screen session via ssh -t <server.domain.name> screen -R
  2. Detach. When done with the SSH session, use ctrl-a d to detach from the session. This also disconnect with the SSH server.
  3. Reconnect. The SSH session is still running actually. When you are ready to resume working with the session, use ssh -t <server.domain.name> screen -R again to reconnect, then you are right where you left it.
  4. Terminate. To permanently terminate a Screen session, just disconnect from the server the usual way (ctrl-d).

Limitation: If you are using apps with graphical interface, not just the command line environment, then screen is not suitable for resuming such jobs, and VNC instead would be the ideal choice.

https://bobbielf2.github.io/blog/2017/09/14/using-gnu-screen-to-resume-an-ssh-session/

如何Scroll Back以及设置Scroll Buffer大小

ctrl+a+ESC: copy mode
you can scroll
ESC: exit copy mode
ctrl+a+: then type scrollback 999999

Screen has its own scroll buffer, as it is a terminal multiplexer and has to deal with several buffers.

Maybe there's a better way, but I'm used to scrolling using the "copy mode" (which you can use to copy text using screen itself, although that requires the paste command too):

  • Hit your screen prefix combination (C-a / control+A by default), then hit Escape.

  • Move up/down with the arrow keys (↑ and ↓).

  • When you're done, hit q or Escape to get back to the end of the scroll buffer.

(If instead of q or Escape you hit Enter or Return and then move the cursor, you will be selecting text to copy, and hitting Enter or Return a second time will copy it. Then you can paste with C-a followed by ].)

Of course, you can always use more and less, two commonly used pagers, which may be enough for some commands.

https://unix.stackexchange.com/questions/40242/scroll-inside-screen-or-pause-output

Press Ctrl-a then : and then type

scrollback 10000

to get a 10000 line buffer, for example.

You can also set the default number of scrollback lines by adding

defscrollback 10000

to your ~/.screenrc file.

To scroll (if your terminal doesn't allow you to by default), press Ctrl-a ESC and then scroll (with the usual Ctrl-f for next page or Ctrl-a for previous page, or just with your mouse wheel / two-fingers). To exit the scrolling mode, just press ESC.

Another tip: Ctrl-a i shows your current buffer setting.

https://stackoverflow.com/questions/8760346/how-do-i-increase-the-scrollback-buffer-in-a-running-screen-session

GNU Screen使用的更多相关文章

  1. 从Tmux 转到GNU Screen

    网上很多地方都说Tmux比GNU Screen要好用,不过无意间看到这篇Switching from tmux to GNU Screen之后,我发现GNU Screen的窗口/区域概念更好,至少是更 ...

  2. GNU Screen Usage

    分屏: 1.在终端输入screen命令 2.Ctrl+a 然后shift+s 上下分屏,切换到下方Ctrl+a tab然后新建一个window(Ctrl+a c) 3.切换到上方,Ctrl+a tab ...

  3. GNU Screen使用入门

    前些天开始学习使用GNU Screen程序,发现这个工具在管理服务器时候确实挺方便的,于是写一篇文章总结一下,顺便介绍Screen的基本使用方法. 简介 GNU Screen是 一个基于文本的全屏窗口 ...

  4. gnu screen的用法

    在使用ssh或者telnet登录远程主机后执行一些耗时的命令, 如果此时ssh或者telnet中断, 那么远程主机上正在执行的程序或者说命令也会被迫终止. screen能够很好地解决这个问题, scr ...

  5. linux 技巧:使用 screen 管理你的远程会话

    你是不是经常需要 SSH 或者 telent 远程登录到 Linux 服务器?你是不是经常为一些长时间运行的任务而头疼,比如系统备份.ftp 传输等等.通常情况下我们都是为每一个这样的任务开一个远程终 ...

  6. linux screen 命令详解

    一.背景 系统管理员经常需要SSH 或者telent 远程登录到Linux 服务器,经常运行一些需要很长时间才能完成的任务,比如系统备份.ftp 传输等等.通常情况下我们都是为每一个这样的任务开一个远 ...

  7. 源码编译安装screen

    OS:Amazon Linux AMI 2015.09.2 (HVM) #sudo su #wget http://ftp.gnu.org/gnu/screen/screen-4.3.1.tar.gz ...

  8. linux screen 命令详解[转]

    一.背景 系统管理员经常需要SSH 或者telent 远程登录到Linux 服务器,经常运行一些需要很长时间才能完成的任务,比如系统备份.ftp 传输等等.通常情况下我们都是为每一个这样的任务开一个远 ...

  9. 使用 screen 管理你的远程会话

    文章转载自:https://www.ibm.com/developerworks/cn/linux/l-cn-screen/ 在此只作为笔记使用,不做他用 你是不是经常需要 SSH 或者 telent ...

随机推荐

  1. cornerstone使用beyond compare比较工具

    prefrences->general->external compare tool->open script foder 新建一个bc.sh文件(名字可以任意,sh后缀即可)保存到 ...

  2. 01.JS语法规范、变量与常量

    前言:    学习一门编程语言的基本步骤   (01)了解背景知识  (02)搭建开发环境  (03)语法规范  (04)常量和变量 2.JS的开发环境 (1)浏览器自带的JS解释器(js引擎) (2 ...

  3. c# 异步编程总结

    异步编程前提 1.学委托 delegate 其中委托中的beginInvoke()和endInvoke()方法必须要会. 2.学习回调函数 (也可以不用,但是一般建议用回调函数中执行endinvoke ...

  4. java 企业站源码 兼容手机平板PC 自适应响应式 SSM主流框架 freemaker 静态引擎

    前台: 支持四套模版, 可以在后台切换   系统介绍: 1.网站后台采用主流的 SSM 框架 jsp JSTL,网站后台采用freemaker静态化模版引擎生成html 2.因为是生成的html,所以 ...

  5. Linux服务器被入侵后的处理过程(转发阿良)

    Linux服务器被入侵后的处理过程   突然,频繁收到一组服务器 ping 监控不可达邮件,赶紧登陆 zabbix 监控系统查看流量状况. 可见流量已经达到了 800M 左右,这肯定不正常了,马上尝试 ...

  6. redis主从同步,总是显示master_link_status:down的解决方法

    小编使用的redis的版本号是5.0.5,可能会略有不同,例如redis.conf配置文件中,没有slaveof这一项配置 使用命令配置主从复制 今天在使用命令slaveof或者是replicaof命 ...

  7. 谷歌BBR拥塞算法内核更新

    为什么想到这个呢,算法什么的又不太懂,这是 因为搭建VPN + BBR 与之简直绝配 有的人搭建SSR ,配一个什么锐速,还需要降内核版本, 而且还容易出错,降了之后更加容易出现兼容性问题,所以偶尔看 ...

  8. 使用jdbc实现ActiveMQ持久化

    步骤一:创建一个数据库 步骤二:配置activemq.xml配置文件 1.在persistenceAdapter加入如下配置 <!--createTablesOnStartup 启动是否创建表 ...

  9. .net core 3.0+unit of work (一)

    1.先将unit of work源码下载 2.引入自己的项目 3.根据原始项目示意在自己项目的startup里注册仓储 由于我不想对每个实体都注册一遍,我使用了泛型仓储(core 2.0好像不支持) ...

  10. SpringBoot整合NoSql--(一)Redis

    简介: Redis是一个开源的使用ANSI C语言编写.遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.它通常被称为数据结构服务器,因为值(v ...