前言:

Linux下的录屏软件不是很多的,但最近在青云云计算官网无意中发现了一个Linux下的录屏神器,非常的nice,只是在分享方面比较弱。

下面将就centos7下如何部署asciinema,以及如何初步使用它做一个简单的介绍。

青云的演示地址:

在 Kubernetes 上最小化安装 KubeSphere

该软件的官方演示地址:

ai script usage examples - asciinema

一,

简介

asciinema 是一个自由开源的用于录制终端会话并将它们分享到网络上的解决方案。

当你在你的终端内运行 asciinema rec 来启动录像时,你输入命令的时候,终端内的所有输出都会被抓取。

当抓取停止时(通过按下 Ctrl-D 或输出 exit),抓取的输出将会被上传到 asciinema.org 的网站,并为后续的回放做准备。

Asciinema 项目由多个不同的完整的部分组成,比如 asciinema 命令行工具、asciinema.org API 和 JavaScript 播放器。

Asciinema 的灵感来自于 script 和 scriptreplay 命令。

那么,这个软件的优势是实时录制,最重要的是可以与播放内容交互,例如,复制录屏里的文字等等。当然,可以基于此软件做运维审计,并且一些比较复杂的操作可以通过此软件录制后分享给需要的同事,使得各种操作更加的直观,一目了然。细节拉满

如果仔细看了上面的示例,我相信你会对它的特点有一个充分的了解,并且会喜欢上这个软件(魅力无法阻挡啊~~~~~~)。

#####附 ,据我的观察,asciinema这个软件是英国的,因为服务器好像是在英国。

二,

asciinema的安装部署

该软件是基于python运行的,而很不幸,Linux自带的Python2.7并不太符合。

该软件的安装方式非常的多,主流部署方式都支持,例如,yum,apt,brew,docker,pip等等,推荐的部署方式是pip,但我并不是特别推荐该方式,因为pip方式还是比较麻烦的。

本例是使用的centos7,因此,本文将以centos7下的yum部署为主。

yum的方式部署需要epel源和OS源,本文都采用阿里云的yum源来进行安装

1,

epel源

cat > /etc/yum.repos.d/eeel.repo <<EOF
[eoel]
name=epel
baseurl=https://mirrors.aliyun.com/epel-archive/7.7/x86_64/
enable=1
gpgcheck=0
EOF

2,

OS源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

3,

开始安装

可以看到安装了Python-3.6

[root@centos4 yum.repos.d]# yum install asciinema
Loaded plugins: fastestmirror
Repository 'local' is missing name in configuration, using id
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
中间省略了。。。。
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transactionInstalling : libtirpc-0.2.4-0.16.el7.x86_64                                                                                                                                            1/6 Installing : python3-setuptools-39.2.0-10.el7.noarch                                                                                                                                   2/6 Installing : python3-pip-9.0.3-8.el7.noarch                                                                                                                                            3/6 Installing : python3-3.6.8-19.el7_9.x86_64                                                                                                                                             4/6 Installing : python3-libs-3.6.8-19.el7_9.x86_64                                                                                                                                        5/6 Installing : asciinema-1.4.0-2.el7.noarch                                                                                                                                              6/6 Verifying  : libtirpc-0.2.4-0.16.el7.x86_64                                                                                                                                            1/6 Verifying  : asciinema-1.4.0-2.el7.noarch                                                                                                                                              2/6 Verifying  : python3-3.6.8-19.el7_9.x86_64                                                                                                                                             3/6 Verifying  : python3-setuptools-39.2.0-10.el7.noarch                                                                                                                                   4/6 Verifying  : python3-pip-9.0.3-8.el7.noarch                                                                                                                                            5/6 Verifying  : python3-libs-3.6.8-19.el7_9.x86_64                                                                                                                                        6/6 Installed:asciinema.noarch 0:1.4.0-2.el7                                                                                                                                                             Dependency Installed:libtirpc.x86_64 0:0.2.4-0.16.el7   python3.x86_64 0:3.6.8-19.el7_9   python3-libs.x86_64 0:3.6.8-19.el7_9   python3-pip.noarch 0:9.0.3-8.el7   python3-setuptools.noarch 0:39.2.0-10.el7

三,

asciinema的初步使用

该命令的帮助:

[root@centos4 ~]# asciinema
usage: asciinema [-h] [--version] {rec,play,upload,auth} ...Record and share your terminal sessions, the right way.positional arguments:{rec,play,upload,auth}rec                 Record terminal sessionplay                Replay terminal sessionupload              Upload locally saved terminal session to asciinema.orgauth                Manage recordings on asciinema.org accountoptional arguments:-h, --help            show this help message and exit--version             show program's version number and exitexample usage:Record terminal and upload it to asciinema.org:asciinema recRecord terminal to local file:asciinema rec demo.jsonRecord terminal and upload it to asciinema.org, specifying title:asciinema rec -t "My git tutorial"Record terminal to local file, "trimming" longer pauses to max 2.5 sec:asciinema rec -w 2.5 demo.jsonReplay terminal recording from local file:asciinema play demo.jsonReplay terminal recording hosted on asciinema.org:asciinema play https://asciinema.org/a/difqlgx86ym6emrmd8u62yqu8For help on a specific command run:asciinema <command> -h

1,

录制一个片段并保存在本地,文件名称为test.json

########注:在录制的时候不能修改时间,否则JSON文件将不能正常结束,也就是文件损坏了,该文件不能播放,或者转出GIF图片了

[root@centos4 ~]# asciinema rec test.json
~ Asciicast recording started.
~ Hit Ctrl-D or type "exit" to finish.
[root@centos4 ~]# cd /opt/
[root@centos4 opt]# ls
containerd  harbor
[root@centos4 opt]# cd
[root@centos4 ~]# ls
123.gif  123.json  docker  docker-19.03.9.tgz  harbor  harbor-offline-installer-v1.5.0.tgz  kubesphere-images-v3.0.0  kubesphere_kiali_v1.38.tar  test.json
[root@centos4 ~]# ls
123.gif  123.json  docker  docker-19.03.9.tgz  harbor  harbor-offline-installer-v1.5.0.tgz  kubesphere-images-v3.0.0  kubesphere_kiali_v1.38.tar  test.json
[root@centos4 ~]# ls
123.gif  123.json  docker  docker-19.03.9.tgz  harbor  harbor-offline-installer-v1.5.0.tgz  kubesphere-images-v3.0.0  kubesphere_kiali_v1.38.tar  test.json
[root@centos4 ~]# rm -rf docker
[root@centos4 ~]# timereal 0m0.000s
user    0m0.000s
sys 0m0.000s
[root@centos4 ~]# date
Wed Jun 28 08:09:45 CST 2023
[root@centos4 ~]# ntpdate ntp.aliyun.com
28 Jun 00:10:18 ntpdate[18369]: step time server 203.107.6.88 offset -28803.509938 sec
[root@centos4 ~]# #OK,录屏结束了!!!,此时是Ctrl+d 退出
[root@centos4 ~]# exit
~ Asciicast recording finished.

2,

将上面录制的名为test.json 的文件转换为GIF格式的图片:

[root@centos4 ~]# docker pull asciinema/asciicast2gif
Using default tag: latest
latest: Pulling from asciinema/asciicast2gif
7b8b6451c85f: Pull complete
ab4d1096d9ba: Pull complete
e6797d1788ac: Pull complete
e25c5c290bde: Pull complete
0d0a810f8aa3: Pull complete
42065bcdfff8: Pull complete
dd637d6e6d34: Pull complete
d67f7d6bcade: Pull complete
dc5855e21089: Pull complete
118eab60d733: Pull complete
837c1093fc9c: Pull complete
274de556230c: Pull complete
c465677e3bd4: Pull complete
91b6be0aaeda: Pull complete
0c13bd3587dc: Pull complete
2af77900a905: Pull complete
Digest: sha256:4ad3f3d913f59178ca69882431c3622cf9b7cd394e4f29e5ab31d4909033bdfc
Status: Downloaded newer image for asciinema/asciicast2gif:latest
docker.io/asciinema/asciicast2gif:latest
[root@centos4 ~]# docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 2 -t solarized-dark test.json test.gif
==> Loading test.json...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 32 screenshots into GIF file...
==> Done.

3,

转换成功的GIF图片:

4,

播放JSON格式的录制的文件 test.json

asciinema play test.json

5,

上传录制的文件到官网

[root@centos4 ~]# asciinema upload test.json
View the recording at:https://asciinema.org/a/593546

打开浏览器,输入https://asciinema.org/a/593546  就可以看到录制的内容了

​​​​​​​

未完待续!!!!

Linux|centos7|终端录屏神器asciinema的部署和初步使用相关推荐

  1. asciinema终端录屏神器使用及过坑

    在github上接触到asciinema,一个强大的神器. 它能够在linux等终端上进行录屏,并且录屏不生成视频文件,而是生成文字形式! 另外,它还能够将录制的结果上传到asciinema.org中 ...

  2. linux tty终端 录屏,在Linux上录制终端的操作

    一.安装基础软件包[root@test software]# yum install libMagickCore libMagickWand libjpeg-turbo-devel libjpeg-t ...

  3. Asciinema终端SSH录屏神器使用

    参考文献:https://yq.aliyun.com/articles/625453(asciinema终端录屏神器使用及过坑) 参考文献:https://zhuanlan.zhihu.com/p/2 ...

  4. 怎么录屏?5 款免费无水印的录屏神器

    无论您是想记录游戏中令人难忘的时刻.与他人分享视频教程,还是做更多类似的事情,都必须使用屏幕录像机.从 Internet 上很容易获得屏幕录像机:然而,找到一个"好"的并不是那么简 ...

  5. 问题步骤记录器——Windows系统下自带的录屏神器?

    问题步骤记录器--Windows系统下自带的录屏神器? 实际上,它是一个抓屛工具, 相当于Linux系统中的捕捉.以截图的方式保存,通过幻灯片放映,达到一种录屏的效果. 什么时候用到问题步骤分析器? ...

  6. linux查询mac地址分屏,Tmux: linux下的分屏神器

    tmux tmux(terminal multiplexer)是Linux上的终端窗口的分屏神器.在一个终端窗口中可以分多个屏同时使用. 安装 Tmux 的安装. # Ubuntu $ sudo ap ...

  7. Ubuntu linux下的录屏

    Ubuntu linux下的录屏 ################## SimpleScreenRecorder ################## 官方网站:http://www.maartenb ...

  8. Camtasia“喀秋莎”2022一款录屏神器

    说实话,可以实现录屏功能的软件有不少,而且有一些还是免费的,但是吴老师仍然强烈向您推荐TechSmith出品的Camtasia,也就是人称"喀秋莎"的一款录屏神器. 文武双全--既 ...

  9. 这款录屏神器在 GitHub 火了,秒杀 33 种同类工具!

    本次推荐一个录屏神器 「Screenity」 ,在 GitHub 上非常火爆,目前已狂揽 4.1K 颗星星. 1. 功能亮点 windows 和 Mac 自带的录屏软件功能都比较有限(windows ...

最新文章

  1. 国外10大IT网站和博客网站
  2. Silverlight实例_人立方
  3. 10分钟了解一致性hash算法
  4. [js]写一个获取非行间样式的方法
  5. 【人脸识别终结者】多伦多大学反人脸识别,身份欺骗成功率达99.5%
  6. 利用dao传值给mysql_koa+mysql+vue+socket.io全栈开发之数据访问篇
  7. CF 504E Misha and LCP on Tree——后缀数组+树链剖分
  8. Python解释器(Interpreter)介绍
  9. 项目管理工具——5W1H分析法
  10. pdf签名无效解决办法_谁告诉你PDF不能修改了?我不仅可以直接编辑,还能随便转化格式!...
  11. Unity中使用TimeSpane计算时差
  12. ajax成功后没有执行函数,ajax请求成功但不执行success-function回调函数的问题
  13. helm模板开发-流程控制、作用域、循环
  14. 论文笔记二 Positive, Negative and Neutral: Modeling Implicit Feedback inSession-based News Recommendatio。
  15. 视频工作室必备利器——群晖NAS
  16. H5打开支付宝小程序
  17. [Unity-26] AnimationClip压缩-动画文件压缩
  18. 搞编程选什么方向好?前端还是后端?阿里程序员和你聊聊就业心得
  19. Kubernetes Pod Evicted
  20. 如何用AE导出程序员可以复用的Json代码

热门文章

  1. 【mahout笔记】初步理解itemCF(基于物品的推荐算法)在mahout的实现
  2. 滚球游戏(动态规划)
  3. 图像分割 - 阈值处理 - 全局阈值处理
  4. VPP Agent 简介
  5. 正确的姿势学习设计模式,设计模式必知必会 --- 面试, 提升篇
  6. 【水一波题解】题解 of University of Central Florida 2020 (Fall) “Practice” Local Programming Contest
  7. echartjs 实现 cross (十星辅助线)跟随吸附高亮点
  8. Flash工具的简单运用
  9. Sir Winston Churchill 温斯顿▪丘吉尔爵士
  10. 喜多力喷码机报Jet Start/Stop prevented by active errors故障