From 351f4c28568723c3af40224176431449b4dfc1bf Mon Sep 17 00:00:00 2001 From: HuanCheng Bai <13283837+bestony@users.noreply.github.com> Date: Thu, 7 Feb 2019 11:24:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Share Your Terminal Sessions On The Fly.md | 107 ++++++++++-------- 1 file changed, 61 insertions(+), 46 deletions(-) rename {sources => translated}/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md (61%) diff --git a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md similarity index 61% rename from sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md rename to translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md index 20bcfbe26d..cde1e24855 100644 --- a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md +++ b/translated/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -1,4 +1,4 @@ -[#]: collector: (lujun9972) + [#]: collector: (lujun9972) [#]: translator: (bestony) [#]: reviewer: ( ) [#]: publisher: ( ) @@ -7,86 +7,93 @@ [#]: via: (https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Asciinema – Record And Share Your Terminal Sessions On The Fly +Asciinema - 在云端记录并分享你的终端会话 ====== -This is known topic and we had already written so many article about this topic. +这个众所周知的话题我们早已经写过了足够多的文章。 -Even today also we are going to discuss about the same topic. +即使这样,我们今天也要去讨论相同的话题。 -Other tools are works locally but Asciinema works in both way like local and web. +其他的工具都是在本地运行的,但是 Asciinema 可以以相同的方式在本地和 Web 端运行。 -I mean we can share the recording on the web. +我的意思是我们可以在 Web 上分享这个录像。 -By default everyone prefer history command to review/recall the previously entered commands in terminal. +默认情况下下,每个人都更愿意使用 history 命令来回看、调用之前在终端内输入的命令。 -But unfortunately, that shows only the commands that we ran and doesn’t shows the commands output which was performed previously. +不过,不行的是,这个命令只展示了我们运行的命令却没有展示这些命令上次运行时的输出。 -There are many utilities available in Linux to record the terminal session activity. +在 Linux 下有很多的组件来记录终端会话活动。 -Also, we had written about few utilities in the past and today also we are going to discuss about the same kind of topic. +在过去,我们也写了一些组件,不过今天我们依然要讨论这同一类心的工具。 -If you would like to check other utilities to record your Linux terminal session activity then you can give a try to **[Script Command][1]** , **[Terminalizer Tool][2]** and **[Asciinema Tool][3]**. +如果你想要使用其他工具来记录你的 Linux 终端会话活动,你可以试试 **[Script Command][1]** , **[Terminalizer Tool][2]** 和 **[Asciinema Tool][3]**. -But if you are looking for **[GIF Recorder][4]** then try **[Gifine][5]** , **[Kgif][6]** and **[Peek][7]** utilities. +不过如果你想要找一个 **[GIF 录制工具][4]**,可以试试 **[Gifine][5]** , **[Kgif][6]** 和 **[Peek][7]**. -### What is Asciinema -asciinema is a free and open source solution for recording terminal sessions and sharing them on the web. +### 什么是 Asciinema -When you run asciinema rec in your terminal the recording starts, capturing all output that is being printed to your terminal while you’re issuing the shell commands. +asciinema 是一个免费且开源的用于录制终端会话并将它们分享到网络上的解决方案。 -When the recording finishes (by hitting `Ctrl-D` or typing `exit`) then the captured output is uploaded to asciinema.org website and prepared for playback on the web. +当你在你的终端内运行 asciinema rec 来启动录像时,你输入命令的时候,终端内的所有输出都会被抓取。 -Asciinema project is built of several complementary pieces such as asciinema command line tool, API at asciinema.org and javascript player. +当抓取停止时(通过按下 `Ctrl-D` 或输出 `exit`),抓取的输出将会被上传到 asciinema.org 的网站,并为后续的回放做准备。 + +Asciinema 项目基于多个不同的完整的部分构建的,比如 asciinema 命令行工具、asciinema.org API 和 JavaScript 播放器。 + +Asciinema 是受到了 script 和 scriptreplay 命令影响而产生的。 Asciinema was inspired by script and scriptreplay commands. -### How to Install Asciinema In Linux +### 如何在 Linux 上安装 Asciinema -It was written in Python and pip installation is a recommended method to install Asciinema on Linux. -Make sure you should have installed python-pip package on your system. If no, use the following command to install it. +Asciinema 基于 Python 写就,在 Linux 上,推荐使用 pip 安装的方法来安装。 + +确保你已经在你的系统里安装了 python-pip 包。如果没有,使用下述命令来安装它。 + + +对于 Debian/Ubuntu 用户,使用 **[Apt 命令][8]**或 **[Apt-Get 命令][9]** 来安装 pip 包。 + -For Debian/Ubuntu users, use **[Apt Command][8]** or **[Apt-Get Command][9]** to install pip package. ``` $ sudo apt install python-pip ``` -For Archlinux users, use **[Pacman Command][10]** to install pip package. +对于 Archlinux 用户, 使用 **[Pacman 命令][10]** 来安装 pip 包。 ``` $ sudo pacman -S python-pip ``` -For Fedora users, use **[DNF Command][11]** to install pip package. +对于 Fedora 用户, 使用 **[DNF 命令][11]** 来安装 pip 包。 ``` $ sudo dnf install python-pip ``` -For CentOS/RHEL users, use **[YUM Command][12]** to install pip package. +对于 CentOS/RHEL 用户, 使用 **[YUM Command][12]** 来安装 pip 包。 ``` $ sudo yum install python-pip ``` -For openSUSE users, use **[Zypper Command][13]** to install pip package. +对于 openSUSE 用户, 使用 **[Zypper Command][13]** 来安装 pip 包。 ``` $ sudo zypper install python-pip ``` -Finally run the following **[pip command][14]** to install Asciinema tool in Linux. +最后,运行如下的 **[pip 命令][14]** 来在 Linux 上安装 Asciinema 工具。 ``` $ sudo pip3 install asciinema ``` -### How to Record Your Terminal Session Using Asciinema +### 如何使用 Asciinema 工具来记录你的终端会话 -Once you successfully installed Asciinema. Just run the following command to start recording. +一旦你成功的安装了 Asciinema,只需要运行如下命令来开始录制 ``` $ asciinema rec 2g-test @@ -94,7 +101,7 @@ asciinema: recording asciicast to 2g-test asciinema: press "ctrl-d" or type "exit" when you're done ``` -For testing purpose run few commands and see whether it’s working fine or not. +为了测试的目的,运行一些简单的命令,并看一看它是否运行的很好。 ``` $ free @@ -141,10 +148,10 @@ L1i cache: 32K L2 cache: 256K L3 cache: 6144K NUMA node0 CPU(s): 0-7 -Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_add fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d ``` -Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in the same directory. +当你完成后,简单的按下 `CTRL+D` 或输入 `exit` 来退出录制。这个结果将会被保存在同一个目录。 ``` $ exit @@ -153,35 +160,37 @@ asciinema: recording finished asciinema: asciicast saved to 2g-test ``` -If you would like to save the output in the different directory then mention the path where you want to save the file. +如果你想要保存输出到不同的目录中,就需要提醒 Asciinema 你想要保存文件的目录 ``` $ asciinema rec /opt/session-record/2g-test1 ``` -We can play the recorded session using the following command. +我们可以使用如下命令来回放录制的会话。 ``` $ asciinema play 2g-test ``` -We can play the recorded session with double speed. +我们能够以两倍速来运行录制的会话。 ``` $ asciinema play -s 2 2g-test ``` -Alternatively we can play the recorded session with normal speed with idle time limited to 2 seconds. +或者,我们可以以正常速度播放录制的会话,限制空白时间为2秒。 ``` $ asciinema play -i 2 2g-test ``` -### How To Share the Recorded Session on The Web +### 如何在网络上分享已经录制的会话 If you would like to share the recorded session with your friends, just run the following command which upload the recording to asciinema.org and provide you the unique link. -It will be automatically archived 7 days after upload. +如果你想要分享录制的会话给你的朋友,只要运行下述上传你的会话到 asciinema.org 的命令,就可以获得一个唯一链接。 + +它将会在被上传 7 天后被归档。 ``` $ asciinema upload 2g-test @@ -201,19 +210,24 @@ installation with asciinema.org account by opening the following link: ![][16] -If you would like to share the recorded session on social media, just click the `Share` button in the bottom of the page. +如果你想要分享录制的会话在社交媒体上,只需要点击页面底部的 `分享` 按钮。 + +如果任何人想要去下载这个录制,只需要点击页面底部的 `下载` 按钮,就可以将其保存在你系统里。 If anyone wants to download this recording, just click the `Download` button in the bottom of the page to save on your system. -### How to Manage Recording on asciinema.org Site +### 如何 asciinema.org 中的录制片段 If you want to preserve all recordings made on this machine, connect this installation with asciinema.org account by opening the following link and follow the instructions. +如果你想要保护所有在这个机器上录制的片段,点击下方的链接并使用你在 asciinema.org 的账户登陆,然后跟随这个说明继续操作。 + ``` https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 ``` -If you have already recorded an asciicast but you don’t see it on your profile on asciinema.org website. Just run the `asciinema auth` command in your terminal to move those. +如果你早已录制了一个 asciicast,但是你没有在你的 asciinema.org 账户界面看到它,只需要运行 `asciinema auth` 命令来移动他们。 + ``` $ asciinema auth @@ -227,7 +241,7 @@ This will associate all recordings uploaded from this machine (past and future o ![][17] -Run the following command if you would like to upload the file directly to asciinema.org instead of locally saving. +如果你想直接上传文件而不是将其保存在本地,直接运行如下命令: ``` $ asciinema rec @@ -235,7 +249,7 @@ asciinema: recording asciicast to /tmp/tmp6kuh4247-ascii.cast asciinema: press "ctrl-d" or type "exit" when you're done ``` -Just run the following command to start recording. +只要运行如下命令来开始录制。 ``` $ asciinema rec 2g-test @@ -243,7 +257,7 @@ asciinema: recording asciicast to 2g-test asciinema: press "ctrl-d" or type "exit" when you're done ``` -For testing purpose run few commands and see whether it’s working fine or not. +出于测试目的,运行下述命令,并看一看它是否运行的很好。 ``` $ free @@ -265,9 +279,10 @@ $ uname -a Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux ``` -Once you have done, simple press `CTRL+D` or type `exit` to stop the recording then hit `Enter` button to upload the recording to asciinema.org website. -It will take few seconds to generate the unique url for your uploaded recording. Once it’s done you will be getting the results same as below. +如果你完成了,简单的按下 `CTRL+D` 或输入 `exit` 来停止录制,然后按下`回车`按钮来上传文件到 asciinema.org 网站。 + +这将会花费一些时间来为你的录制生成唯一链接。一旦它完成,你会看到和下面一样的样式: ``` $ exit @@ -286,7 +301,7 @@ via: https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-shar 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[Bestony](https://github.com/bestony) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出