专栏首页苏生不惑命令行录制工具 asciinema

命令行录制工具 asciinema

平常出bug求助的时候有时候贴代码或者截图往往不直观,如果能重现给对方看就好了,这里推荐 2 个命令行的录制工具。

asciinema

网站https://asciinema.org/,github主页https://github.com/asciinema 直接使用 pip install asciinema来安装。 执行asciinema rec 开始录制,录制完成后 exit 退出,可以保存到本地或者上传到 https://asciinema.org

[root@VM_0_14_centos ~]# asciinema rec
asciinema: recording asciicast to /tmp/tmp1ua5a2rx-ascii.cast
asciinema: press <ctrl-d> or type "exit" when you're done
[root@VM_0_14_centos ~]# pwd
/root
[root@VM_0_14_centos ~]# cd /usr/share/nginx/html/
[root@VM_0_14_centos html]# pip install asciinema
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Requirement already satisfied: asciinema in /usr/lib/python3.4/site-packages (2.0.2)
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@VM_0_14_centos html]# pip list |grep ascii
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
asciinema              2.0.2
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@VM_0_14_centos html]# exit
exit
asciinema: recording finished
asciinema: press <enter> to upload to asciinema.org, <ctrl-c> to save locally

View the recording at:

    https://asciinema.org/a/AdnqMX0QfOg5c7USOtwHZ4Hz1

This installation of asciinema recorder hasn't been linked to any asciinema.org
account. All unclaimed recordings (from unknown installations like this one)
are automatically archived 7 days after upload.

If you want to preserve all recordings made on this machine, connect this
installation with asciinema.org account by opening the following link:

    https://asciinema.org/connect/01fb0f0e-c56a-450f-80ac-4020188dd957

录制过程在https://asciinema.org/a/AdnqMX0QfOg5c7USOtwHZ4Hz1 可以看到了。

image.png

如果分享给他人可以用邮箱注册,它不需要密码就可以注册。我注册后的主页https://asciinema.org/~susheng 然后打开这个链接 https://asciinema.org/connect/01fb0f0e-c56a-450f-80ac-4020188dd957 就会保存到你账号下。

image.png

设置为public 后可生成公开链接,可分享给他人观看,还可以嵌入到自己的网站。

image.png

image.png

视频链接后加 .png 是视频截图 https://asciinema.org/a/254348.png ,而链接后加 .js 就可以直接嵌入网站了。

<a href="https://asciinema.org/a/254348" target="_blank"><img src="https://asciinema.org/a/254348.svg" /></a>
<script src="https://asciinema.org/a/254348.js" id="asciicast-254348" async data-autoplay="true" data-size="big"></script>

TermRecord

TermRecord也是用 pip 安装 pip install TermRecord, 直接开始录制 TermRecord -o termrecord.html输入 exit 结束录制 。这个 termrecord.html 就是录制生成的文件,可以直接用浏览器打开。

[root@VM_0_14_centos html]# TermRecord -o termrecord.html
Script started, file is /tmp/tmpdekpz_p2
[root@VM_0_14_centos html]# pwd
/usr/share/nginx/html
[root@VM_0_14_centos html]# whoami
root
[root@VM_0_14_centos html]# pip install TermRecord
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Requirement already satisfied: TermRecord in /usr/lib/python3.4/site-packages (1.2.5)
Requirement already satisfied: Jinja2>=2.6 in /usr/lib64/python3.4/site-packages (from TermRecord) (2.10.1)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/lib64/python3.4/site-packages (from Jinja2>=2.6->TermRecord) (1.1.1)
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@VM_0_14_centos html]# pip list|grep Term
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
TermRecord             1.2.5
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@VM_0_14_centos html]# exit
exit
Script done, file is /tmp/tmpdekpz_p2

然后打开文件就可以看到录制过程了 http://118.24.158.116:8888/termrecord.html

image.png

另外还有个基于ruby的showterm和termtosvg就不演示了 http://showterm.io/ https://github.com/nbedos/termtosvg

本文分享自微信公众号 - 苏生不惑(susheng_buhuo),作者:苏生不惑

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2019-07-09

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • ppt 神器 reveal

    ppt相信大家都用过,不过程序员使用的PPT是可以在网页上用的,比如 reveal

    苏生不惑
  • 如何下载优酷 m3u8 格式的视频文件?

    平常最熟悉的视频文件格式就是mp4了,比如这个微博视频就是mp4格式https://weibo.com/tv/v/I6NlI3XNO?fid=1034:4416...

    苏生不惑
  • 微软全新浏览器 Microsoft Edge 比 谷歌 Chrome 好用吗?

    微软的IE浏览器是Windows上默认安装的浏览器,大家都用过,在还没有Chrome浏览器的时候没觉得它怎么不好用,直到后来谷歌出了Chrome浏览器,嗯,真香...

    苏生不惑
  • linux下expect环境安装以及简单脚本测试

    expect是交互性很强的脚本语言,可以帮助运维人员实现批量管理成千上百台服务器操作,是一款很实用的批量部署工具! expect依赖于tcl,而linux系统里...

    洗尽了浮华
  • GitHub 迎史上最大改变?先看看 2018 年度统计报告再说吧!

    作为 GitHub 的忠实使用者,一直都在密切关注者 GitHub 的一举一动,尤其是被微软收购以后,GitHub 变得貌似更加频繁了。变化咱们先不说,先来看看...

    非著名程序员
  • GitHub上10个最受欢迎的安全项目

    开源项目最终还是迎来了属于它的胜利,虽然这胜利姗姗来迟,但终究还是实现了。在信息安全领域,尽管许多公司封锁了它们的专有软件代码,但仍有许多开源项目可供安全专家使...

    FB客服
  • 资源 | 机器学习标准教科书PRML的Python实现:最佳读书伴侣

    机器之心
  • 机器学习标准教科书PRML的Python实现:最佳读书伴侣

    选自GitHub 机器之心整理 参与:蒋思源 机器学习神书之一的 PRML(模式识别与机器学习)是所有机器学习读者或希望系统理解机器学习的读者所必须了解的书籍。...

    企鹅号小编
  • 局域网内的NIS服务器器搭建管理

    NIS(网络信息服务),用来集中账号信息管理。类似LDAP一样的功能哦,一般可以作为LAN内的用户认证服务器吧! NIS服务器提供的数据: /etc/passw...

    BG彪
  • leetcode: 112. Path Sum

    Petrichor_

扫码关注云+社区

领取腾讯云代金券