Asciinema 是一个轻量并且非常高效的终端会话录制器。使用它可以录制、回放和分享 JSON 格式的终端会话记录。最主要的优点是,它能够以通过 ASCII 文本以及 ANSI 转义码编码来录制所有的标准终端输入、输出和错误信息。 -- Lubos Rendek
本文导航
-简介 …… 00%
-从软件库安装 …… 11%
-从源代码安装 …… 19%
-录制终端会话 …… 43%
-回放已录制终端会话 …… 62%
-将视频嵌入 HTML …… 70%
-结论 …… 83%
-故障排除 …… 90%
编译自: https://linuxconfig.org/record-and-replay-terminal-session-with-asciinema-on-linux
作者: Lubos Rendek
译者: ucasFL
# pacman -S asciinema
# apt install asciinema
$ sudo apt install asciinema
$ sudo dnf install asciinema
# pacman -S git gcc make ruby
# apt install git gcc make ruby
$ sudo apt install git gcc make ruby
$ sudo dnf install git gcc make ruby
# yum install git gcc make ruby
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"
$ echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile
$ . ~/.bash_profile
$ brew --version
Homebrew 1.1.7
Homebrew/homebrew-core (git revision 5229; last commit 2017-02-02)
$ brew install asciinema
$ asciinema --version
asciinema 1.3.0
$ asciinema rec
$ su
Password:
# apt install sl
# exit
$ sl
$ exit
~ Asciicast recording finished.
~ Press <Enter> to upload, <Ctrl-C> to cancel.
https://asciinema.org/a/7lw94ys68gsgr1yzdtzwijxm4
$ asciinema rec /tmp/my_rec.json
$ asciinema rec -w 0.2
$ asciinema play https://asciinema.org/a/7lw94ys68gsgr1yzdtzwijxm4
$ asciinema play /tmp/my_rec.json
$ wget -q -O steam_locomotive.json https://asciinema.org/a/7lw94ys68gsgr1yzdtzwijxm4.json
$ asciinema play steam_locomotive.json
$ cd /tmp/
$ mkdir steam_locomotive
$ cd steam_locomotive/
$ wget -q -O steam_locomotive.json https://asciinema.org/a/7lw94ys68gsgr1yzdtzwijxm4.json
$ wget -q https://github.com/asciinema/asciinema-player/releases/download/v2.4.0/asciinema-player.css
$ wget -q https://github.com/asciinema/asciinema-player/releases/download/v2.4.0/asciinema-player.js
<html>
<head>
<link rel="stylesheet" type="text/css" href="./asciinema-player.css" />
</head>
<body>
<asciinema-player src="./steam_locomotive.json" cols="80" rows="24"></asciinema-player>
<script src="./asciinema-player.js"></script>
</body>
</html>
$ asciinema rec
asciinema needs a UTF-8 native locale to run. Check the output of &#x60;locale&#x60; command.
$ localedef -c -f UTF-8 -i en_US en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
欢迎光临 51学通信论坛2017新版 (http://bbs.51xuetongxin.com/) | Powered by Discuz! X3 |