Asciinema-Linux终端录屏
Asciinema是一个类似[[script命令-记录终端交互会话过程|script]]的命令,它也可以录制终端会话。但相比Script它还可以方便的分享到网络以供他人查看。
安装
通用安装方式
Asciinema在PyPl上可用,可以直接使用pip进行安装(需要[[Python3.7.2安装|Python3]])。相比于其它安装方式,这种安装方式始终是最新版本
pip3 install asciinema注意: pip安装后asciinema不会自动添加到$PATH环境变量中,默认是在~/.local/bin/
系统包管理器安装
Asciinema在常见的Linux系统中可以直接使用自带的包管理工具进行安装,支持的系统有Arch Linux、Debian、Fedora、Gentoo Linux、openSUSE、Ubuntu
其它安装方式
其它的像MacOS、FreeBSD、Docker等环境也支持安装,安装方法请参考官方文档
使用
录制
语法格式
asciinema rec <FILENAME> <OPTION>可用选项:
--stdin- 启用 stdin(键盘)录制(见下文)
--append- 附加到现有录制文件
--raw- 保存原始STDOUT输出,无需计时信息或其他元数据
--overwrite- 覆盖录制(如果已存在)
-c, --command=<command>- 指定要录制的命令,默认为$SHELL
-e, --env=<var-names>- 要捕获的环境变量列表,默认为SHELL,TERM
-t, --title=<title>- 指定 asciicast 的标题
-i, --idle-time-limit=<sec>- 将记录的终端不活动限制为最大秒数<sec>
-y, --yes- 对所有提示回答“是”(例如,上传确认)
-q, --quiet- 保持安静,抑制所有通知/警告(暗示-y)
播放/回放
语法格式
asciinema play <FILENAME>选项:
-i --idle-time-limit=<sec>- 将重播终端不活动限制为最大秒数<sec>。比如正常空闲了10秒,指定
-i 2之后,空闲时间则只显示为2秒-s --speed=<factor>- 播放速度(可以有小数点,1.5 2.5)
授权/认证,分享
asciinema auth
Open the following URL in a web browser to link your install ID with your asciinema.org user account:
https://asciinema.org/connect/xxxxxxx
This will associate all recordings uploaded from this machine (past and future ones) to your account, and allow you to manage them (change title/theme, delete) at asciinema.org.
在浏览器打开上面的链接注册登录授权
上传
asciinema upload test-demo
View the recording at:
https://asciinema.org/a/7t8CPL6IwgypRz7avkBnoIo7o
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/0d0b0c31-7813-4258-9f65-d56f4c47d049
最后更新于