使用 Showterm 录制和分享终端会话
录制 终端
![](/data/attachment/album/201803/12/084738nalur9xbo4lzjrg4.jpg)


你可以使用几乎所有的屏幕录制程序轻松录制终端会话。但是，你很可能会得到超大的视频文件。Linux 中有几种终端录制程序，每种录制程序都有自己的优点和缺点。Showterm 是一个可以非常容易地记录终端会话、上传、分享，并将它们嵌入到任何网页中的工具。一个优点是，你不会有巨大的文件来处理。


Showterm 是开源的，该项目可以在这个 [GitHub 页面](https://github.com/ConradIrwin/showterm)上找到。


**相关**：[2 个简单的将你的终端会话录制为视频的 Linux 程序](https://www.maketecheasier.com/record-terminal-session-as-video/ "2 Simple Applications That Record Your Terminal Session as Video [Linux]")


### 在 Linux 中安装 Showterm


Showterm 要求你在计算机上安装了 Ruby。以下是如何安装该程序。



```
gem install showterm

```

如果你没有在 Linux 上安装 Ruby，可以这样：



```
sudo curl showterm.io/showterm > ~/bin/showterm
sudo chmod +x ~/bin/showterm

```

如果你只是想运行程序而不是安装：



```
bash <(curl record.showterm.io)

```

你可以在终端输入 `showterm --help` 得到帮助页面。如果没有出现帮助页面，那么可能是未安装 `showterm`。现在你已安装了 Showterm（或正在运行独立版本），让我们开始使用该工具进行录制。


**相关**：[如何在 Ubuntu 中录制终端会话](https://www.maketecheasier.com/record-terminal-session-in-ubuntu/ "How to Record Terminal Session in Ubuntu")


### 录制终端会话


![showterm terminal](/data/attachment/album/201803/12/084738xl2ranrndrrdtglc.png "showterm terminal")


录制终端会话非常简单。从命令行运行 `showterm`。这会在后台启动终端录制。所有从命令行输入的命令都由 Showterm 记录。完成录制后，请按 `Ctrl + D` 或在命令行中输入`exit` 停止录制。


Showterm 会上传你的视频并输出一个看起来像 `http://showterm.io/<一长串字符>` 的链接的视频。不幸的是，终端会话会立即上传，而没有任何提示。请不要惊慌！你可以通过输入 `showterm --delete <recording URL>` 删除任何已上传的视频。在上传视频之前，你可以通过在 `showterm` 命令中添加 `-e` 选项来改变计时。如果视频无法上传，你可以使用 `showterm --retry <script> <times>` 强制重试。


在查看录制内容时，还可以通过在 URL 中添加 `#slow`、`#fast` 或 `#stop` 来控制视频的计时。`#slow` 让视频以正常速度播放、`#fast` 是速度加倍、`#stop`，如名称所示，停止播放视频。


Showterm 终端录制视频可以通过 iframe 轻松嵌入到网页中。这可以通过将 iframe 源添加到 showterm 视频地址来实现，如下所示。


![showtermio](/data/attachment/album/201803/12/084738c5vbx55zv1382b3n.png "showtermio")


作为开源工具，Showterm 允许进一步定制。例如，要运行你自己的 Showterm 服务器，你需要运行以下命令：



```
export SHOWTERM_SERVER=https://showterm.myorg.local/

```

这样你的客户端可以和它通信。还有额外的功能只需很少的编程知识就可添加。Showterm 服务器项目可在此 [GitHub 页面](https://github.com/ConradIrwin/showterm)获得。


### 结论


如果你想与同事分享一些命令行教程，请务必记得 Showterm。Showterm 是基于文本的。因此，与其他屏幕录制机相比，它将产生相对较小的视频。该工具本身尺寸相当小 —— 只有几千字节。




---


via: <https://www.maketecheasier.com/record-terminal-session-showterm/>


作者：[Bruno Edoh](https://www.maketecheasier.com/author/brunoedoh/) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
You can easily record your terminal sessions with virtually all screen recording programs. However, you are very likely to end up with an oversized video file. There are several terminal recorders available in Linux, each with its own strengths and weakness. Showterm is a tool that makes it pretty easy to record terminal sessions, upload them, share, and embed them in any web page. On the plus side, you don’t end up with any huge file to deal with.

Showterm is open source, and the project can be found on this [GitHub page](https://github.com/ConradIrwin/showterm).

**Also read:** [2 Simple Applications That Record Your Terminal Session as Video [Linux]](https://www.maketecheasier.com/record-terminal-session-as-video/)

## Installing Showterm for Linux

Showterm requires that you have Ruby installed on your computer. Here’s how to go about installing the program.

`gem install showterm`

If you don’t have Ruby installed on your Linux system:

sudo curl showterm.io/showterm > ~/bin/showterm sudo chmod +x ~/bin/showterm

If you just want to run the application without installation:

bash <(curl record.showterm.io)

You can type `showterm --help`

for the help screen. If a help page doesn’t appear, showterm is probably not installed. Now that you have Showterm installed (or are running the standalone version), let us dive into using the tool to record.

**Also read:** [How to Record Terminal Session in Ubuntu](https://www.maketecheasier.com/record-terminal-session-in-ubuntu/)

## Recording Terminal Session

Recording a terminal session is pretty simple. From the command line run `showterm`

. This should start the terminal recording in the background. All commands entered in the command line from hereon are recorded by Showterm. Once you are done recording, press Ctrl + D or type `exit`

in the command line to stop your recording.

Showterm should upload your video and output a link to the video that looks like http://showterm.io/<long alpha-numeric characters>. It is rather unfortunate that terminal sessions are uploaded right away without any prompting. Don’t panic! You can delete any uploaded recording by entering `showterm --delete <recording URL>`

. Before uploading your recordings, you’ll have the chance to change the timing by adding the `-e`

option to the showterm command. If by any chance a recording fails to upload, you can use `showterm --retry <script> <times>`

to force a retry.

When viewing your recordings, the timing of the video can also be controlled by appending “#slow,” “#fast,” or “#stop” to the URL. Slow makes the video run at normal speed; fast doubles the speed; and stop, as the name suggests, stops the video.

Showterm terminal recordings can easily be embedded in web pages via iframes. This can be achieved by adding the iframe source to the showterm video URL as shown below.

As an open source tool, Showterm allows for further customization. For instance, to run your own Showterm server, you need to run the command:

export SHOWTERM_SERVER=https://showterm.myorg.local/

so your client can communicate with it. Additional features can be added with little programming knowledge. The Showterm server project is available from this [GitHub page](https://github.com/ConradIrwin/showterm).

## Conclusion

In case you are thinking of sharing some command line tutorials with a colleague, be sure to remember Showterm. Showterm is text-based; hence, it will yield a relatively small-sized video compared to other screen recorders. The tool itself is pretty small in size – only a few kilobytes.

Our latest tutorials delivered straight to your inbox