=Start=
缘由:
GNU screen命令可以提供:
- 会话恢复
- 多窗口
- 会话共享
并且,它据说「Extremely stable (v1.0 was in 1987)」,而且一般都是默认安装了的。
参考解答:
#创建screen会话 screen -S learn_screen #暂时离开screen会话 Ctrl+a d #(按住Ctrl,依次按a,再按d)即可退出刚才的screen的会话 #查看正在运行中的screen会话,同时会列出ID号 screen -ls #一开始就进行录屏 screen -L #重新读取screen会话(使用该命令时,screen的状态一定要是Detached,也就是说没有用户连在screen里,否则你就无法进入该screen会话) screen -r $screen_name #或 screen -r $screen_id #连接一个screen进程,如果该进程是attached,就先踢掉远端用户再连接(使用该命令时,screen的状态一定要是Attached,也就是说有用户连在screen里) screen -d -r $screen_id #会话共享# #还有一种比较好玩的会话恢复,可以实现会话共享。假设你在和朋友在不同地点以相同用户登录一台机器,然后你创建一个 Screen 会话,你朋友可以在他的终端上命令: screen -x #这个命令会将你朋友的终端 Attach 到你的 Screen 会话上,并且你的终端不会被 Detach。 这样你就可以和朋友共享同一个会话了,如果你们当前又处于同一个窗口,那就相当于坐在同一个显示器前面,你的操作会同步演示给你朋友,你朋友的操作也会同步演示给你。当然,如果你们切换到这个会话的不同窗口中去,那还是可以分别进行不同的操作的。 #关闭screen会话 #若不再需要当前的screen会话,可以在当前的screen会话中执行 exit ,提示[screen is terminating]表示已经成功关闭screen会话(不会保留在内存中);如果需要,请按第一步重建。 #关于screen的快捷键 Ctrl + a c :在当前screen会话中创建一个子会话 Ctrl + a w :子会话列表 Ctrl + a p :上一个子会话 Ctrl + a n :下一个子会话 Ctrl + a 0-9 :在第0窗口至第9子会话间切换 Ctrl + a ? :查看screen的帮助页面 Ctrl + a H :记录screen的输出(录屏) Ctrl + a x :锁屏(需要你有该Linux登录用户的登录密码才能解锁,否则,当前的会话终端算是废了,你需要重新打开一个终端才行)(锁屏后,重新登录一个设置过密码的screen会话,你需要输入2次密码,第一次是输入Linux系统的登录密码,第二次是输入该screen会话的密码) #所以,强烈建议,将「锁屏命令」给换一个快捷键,要不然在你不知道系统登录密码的情况下,真的是相当坑爹!!!设置一个密码用来保护当前screen会话就行了,没必要非得「Ctrl + a x」锁屏。 Ctrl + a :password :设置screen会话的密码(如果你不将加密后的密码串放入「~/.screenrc」文件中,那screen只会临时加密当前会话;如果将加密后的密码串放入「~/.screenrc」中,则默认都是需要该密码进行访问控制的) Ctrl + a ] :粘贴screen剪贴板中的内容
参考链接:
- http://www.kwx.gd/CentOSApp/CentOS-screen.html
- https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/
- http://gnailuy.com/linux/2011/07/24/beginning-gnu-screen/
- http://noalgo.info/1000.html
- https://www.ibm.com/developerworks/cn/linux/l-cn-screen/
- http://linux.51yip.com/search/screen
- http://superuser.com/questions/423310/byobu-vs-gnu-screen-vs-tmux-usefulness-and-transferability-of-skills
- http://superuser.com/questions/236158/tmux-vs-screen
- http://unix.stackexchange.com/questions/549/tmux-vs-gnu-screen
=END=
《 “Linux下screen命令的使用” 》 有 3 条评论
一些Tmux教程
https://danielmiessler.com/study/tmux/
https://linux.cn/article-5666-1.html
http://blog.jeswang.org/blog/2013/06/24/tmux-kuai-su-jiao-cheng/
14 Best Free and Open Source Terminal Session Recording
https://www.linuxlinks.com/best-free-open-source-terminal-session-recording/
`
The vast majority of computer users depend on a graphical user interface, and fear the command line. However, the command line holds significant power and versatility. Commands issued from a shell offer system administrators a quick and easy way to update, configure and repair a system.
Command-Line InterfaceThe benefits of the command line are not only confined to system administration. The ability to transverse the file system quickly, give more information about files and directories, automate tasks, bring together the power of multiple console tools in a single command line, and run shell scripts are just a few examples of how the command line can offer a potent, multifarious toolbox.
A screencast is a digital recording of computer screen output, often carrying audio narration. Screencasting software takes a series of screenshots of a running application, recording the user’s actions, and creating a video file. This type of software was brought into prominence by the commercial Windows application Lotus ScreenCam in 1994. The vast majority of screencasting tools capture a graphical environment. However, here we examine tools that capture your terminal sessions. Think of them as console screencasting tools.
Screencasts have a wide variety of uses. This type of software is often deployed to describe software projects, report bugs, and for evaluating technical skills. Plain text screencasting lets you explain and perform commands at the same time, simultaneously offering a tutorial and showcase. Further, plain text screencasting uses less bandwidth than video, and provides a powerful educational tool.
Here’s our verdict captured in a legendary LinuxLinks-style ratings chart. Only free and open source software is eligible for inclusion.
绝大多数计算机用户都依赖于图形用户界面,而惧怕命令行。然而,命令行功能强大,用途广泛。从 shell 中发出的命令为系统管理员提供了更新、配置和修复系统的快捷方式。
命令行界面命令行的好处不仅限于系统管理。快速浏览文件系统、提供文件和目录的更多信息、自动执行任务、在单个命令行中汇集多个控制台工具的强大功能以及运行 shell 脚本,这些只是命令行如何提供强大、多样工具箱的几个例子。
截屏是计算机屏幕输出的数字录音,通常带有音频旁白。截屏软件对运行中的应用程序进行一系列截屏,记录用户的操作,并创建视频文件。1994 年,商业 Windows 应用程序 Lotus ScreenCam 使这类软件崭露头角。绝大多数截屏工具都能捕捉图形环境。不过,在这里我们要研究的是捕捉终端会话的工具。将它们视为控制台截屏工具。
截屏用途广泛。这类软件通常用于描述软件项目、报告错误和评估技术技能。纯文本截屏可以让你同时解释和执行命令,提供教程和展示。此外,纯文本截屏使用的带宽比视频少,是一种强大的教育工具。
以下是我们的评判结果,采用的是富有传奇色彩的 LinuxLinks 式评分表。只有自由和开放源码软件才有资格入选。
==
Terminalizer Generates animated GIF images of your terminal
asciinema Record and share terminal sessions
ttystudio Excellent terminal-to-gif recorder
termtosvg Render SVG animations of shell sessions
ffscreencast Shell wrapper for ffmpeg that allows fool-proof screen recording
Showterm Terminal record and upload utility
tty2gif Record scripts into both binary and gif formats
TermRecord Terminal session recorder with easy-to-share self-contained HTML output
ttyrec Terminal recorder, incudes a playback tool
termrec Set of tools for recording and replaying tty sessions
Shelr Broadcast plain text screencasts
screencast Interface to record a X11 desktop
IPBT High-tec terminal player
script The granddaddy of terminal recorders
`
在堡垒主机上记录ssh会话
How to Record SSH Sessions Established Through a Bastion Host
https://aws.amazon.com/cn/blogs/security/how-to-record-ssh-sessions-established-through-a-bastion-host/
`
A bastion host is a server whose purpose is to provide access to a private network from an external network, such as the Internet. Because of its exposure to potential attack, a bastion host must minimize the chances of penetration. For example, you can use a bastion host to mitigate the risk of allowing SSH connections from an external network to the Linux instances launched in a private subnet of your Amazon Virtual Private Cloud (VPC).
In this blog post, I will show you how to leverage a bastion host to record all SSH sessions established with Linux instances. Recording SSH sessions enables auditing and can help in your efforts to comply with regulatory requirements.
堡垒主机是一种服务器,其目的是从外部网络(如互联网)访问专用网络。由于可能受到攻击,堡垒主机必须最大限度地减少被渗透的机会。例如,您可以使用堡垒主机来降低允许 SSH 从外部网络连接到亚马逊虚拟私有云(VPC)私有子网中启动的 Linux 实例的风险。
在这篇博文中,我将向你展示如何利用 bastion 主机记录与 Linux 实例建立的所有 SSH 会话。记录 SSH 会话可以进行审计,并有助于您遵守监管要求。
`