资讯专栏INFORMATION COLUMN

命令行录制工具 asciinema

enali / 1431人阅读

摘要:平常出求助的时候有时候贴代码或者截图往往不直观,如果能重现给对方看就好了,这里推荐个命令行的录制工具。执行开始录制录制完成后退出,可以保存到本地或者上传到。录制过程在可以看到了。这个就是录制生成的文件,可以直接用浏览器打开。

平常出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  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  to upload to asciinema.org,  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/AdnqM... 可以看到了。

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

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

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


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

然后打开文件就可以看到录制过程了

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

推荐阅读:

那些你可能不知道的浏览器奇技淫巧

那些你可能不知道的微信奇技淫巧

那些你可能不知道的微博奇技淫巧

那些你可能不知道的网易云音乐奇技淫巧

那些你可能不知道的搜索奇技淫巧

那些你可能不知道的视频下载奇技淫巧

那些你可能不知道的免费观看 VIP 视频奇技淫巧

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/45128.html

相关文章

  • 那些有趣/用的 Python 库

    摘要:梁振英在星期二月日的答问大会开始之际在其演说中道歉,但强调他在违章建筑问题上没有隐瞒的意图和动机。 图片处理 pip install pillow from PIL import Image import numpy as np a = np.array(Image.open(test.jpg)) b = [255,255,255] - a im = Image.fromarray(...

    Pikachu 评论0 收藏0
  • VIM宏初体验

    摘要:,法师拉餐桌吐槽宏等。计算机科学里的宏,是一种批量批处理的称谓。这里的的意识就是执行指定寄存器里的内容,也就是我们做好的宏。宏初体验就到这里年月日补充用录制的,非常方便的录屏工具。 第一次知道宏这东西是在word里面,经常莫名其妙弹出一个框说宏xxxxx,完全不明所以。那时候只知道有宏那么个东西,至于他是干嘛的,压根不知晓。 第一次用宏还是在玩WOW的时候,那时候流行在动作上加上一些个...

    explorer_ddf 评论0 收藏0

发表评论

0条评论

enali

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<