博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
screen的功用
阅读量:2066 次
发布时间:2019-04-29

本文共 2040 字,大约阅读时间需要 6 分钟。

介绍

screen是一个full-screen窗口管理器,用于管理多个交互式的shell通过一个物理的终端。每个虚拟终端提供了DES VT100终端功能,附加多中ISO 4629(ECMA 48, ANSI X3.64ISO 2022标准)控制功能(例如:insert/delete 行和支持多字节设定)。这里有一个滚动历史buff框为每个虚拟终端而且复制粘贴机制允许你去拷贝文本区域在这些虚拟终端之间。

这段文字是直接翻译的man中来做参考。里面读出来的信息就是说,其实这个screen是利用一个物理终端来管理多个虚拟终端。而且他是一个全屏的命令。为啥我们要使用这个呢。这个疑问我刚刚开始的时候也有。在使用了之后才觉得这个东西是个神器。之前我去连接服务器的时候,大都是通过xshell去连接。当然有些事用来打开vim。有些窗口是用于去makefile,有些窗口是用于做做console方式运行服务器。这样相安无事的也的确很好。但是,如果本来我在家里通过远程去调试了服务器,事情没有做完现在要出去有事,或者家里网络断掉了,就造成已经打开的vim、makefile、console方式的服务器session全部关闭。这些session上的全部东西都被终结了。但是有了screen就不同了。我可以将vim,make,console svr都放到我一个screen的虚拟容器中。当掉线,或者我自己想暂时的退出的时候,只需要按一下ctrl+a+d。今后有网络的时候,将可以重新唤起之前的编辑环境回来。

创建&查看

我们可以通过下面的命令来创建一个名字为learn的screen

$screen -S learn$screen -list

这个是man里面提供的帮助信息。

-S sessionname            When creating a new session, this option can be used to specify a meaningful name for the session. This name identifies the session for "screen  -list"            and "screen -r" actions. It substitutes the default [tty.host] suffix.       -list [match]            does  not  start  screen,  but  prints a list of pid.tty.host strings identifying your screen sessions.  Sessions marked `detached' can be resumed with            "screen -r". Those marked `attached' are running and have a controlling terminal. If the session runs in multiuser mode, it is marked `multi'. Sessions            marked  as  `unreachable'  either  live on a different host or are `dead'.  An unreachable session is considered dead, when its name matches either the            name of the local host, or the specified parameter, if any.  See the -r flag for a description how to construct matches.   Sessions  marked  as  `dead'            should be thoroughly checked and removed.  Ask your system administrator if you are not sure. Remove sessions with the -wipe option.

窗口

创建新的一个窗口

ctrl + a + c

在screen容器中循环的切换窗口列表

ctrl+a+space

在screen容器中切换最近的两个窗

ctrl+a+a

向前切换一个窗口

ctrl+a+p

向后切换一个窗口

ctrl+a+n

直接定位窗口

ctrl+a+[0-9]

挂起&唤醒

挂起

ctrl+a+d

唤起

screent -r learn

注意

如果你发现ctrl+a这一系列的命名对你无效的时候,绝逼是你没有在一个screen里面。这点切记。

转载地址:http://nbfmf.baihongyu.com/

你可能感兴趣的文章
Prometheus hang 住问题定位解决
查看>>
别看 DNS 污染闹得欢,现在我用 CoreDNS 将它拉清单
查看>>
百度为什么掉队了
查看>>
Containerd 中的 Snapshot 到底是个什么鬼?
查看>>
Dockerd 资源泄露怎么办
查看>>
高性能 Nginx HTTPS 调优 - 如何为 HTTPS 提速 30%
查看>>
在 Kubernetes 中部署高可用 Harbor 镜像仓库
查看>>
容器网络一直在颤抖,罪魁祸首竟然是 ipvs 定时器
查看>>
阿里宣布拆中台,首当其冲就是优化数据中台架构?
查看>>
Cilium 源码解析:Node 之间的健康探测(health probe)机制
查看>>
前几天是谁说 WireGuard 不香的?看我今天怎么怼你
查看>>
配置 containerd 镜像仓库完全攻略
查看>>
iTerm 2 使用触发器和 expect 实现 ssh 自动登录
查看>>
Kubernetes Pod 突然就无法挂载 Ceph RBD 存储卷了。。
查看>>
解决 Kubernetes 部署 Metrics Server 无法访问 Apiserver 问题
查看>>
AWS 容器三大新品:K8s 发行版,免费镜像库和 “Game Changer”AWS Proton
查看>>
多平台容器镜像构建就看这一篇
查看>>
macOS Big Sur 使用全新虚拟化框架创建超轻量虚拟机!
查看>>
16 岁高中生成功在 iPhone 7 上安装 Ubuntu 20.04 桌面!
查看>>
两个程序都要用同一个端口,怎么解?
查看>>