mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
388f078c27
@ -1,24 +1,26 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10435-1.html)
|
||||
[#]: subject: (Snake your way across your Linux terminal)
|
||||
[#]: via: (https://opensource.com/article/18/12/linux-toy-snake)
|
||||
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||
|
||||
在 Linux 终端中玩贪吃蛇
|
||||
======
|
||||
有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。
|
||||
|
||||
> 有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu)
|
||||
|
||||
欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己甚至是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。
|
||||
欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问什么是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。
|
||||
|
||||
我们这周都在介绍游戏,这很有趣,接着让我们看下今天的游戏,贪吃蛇!
|
||||
|
||||
贪吃蛇是一个古老又很好的游戏。它的版本似乎一直存在着。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。
|
||||
贪吃蛇是一个古老又很好的游戏,这些年一直有各种版本。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。
|
||||
|
||||
今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它几乎一定为你的发行版打包了。
|
||||
今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它的发行版几乎一定有它。
|
||||
|
||||
但我喜欢的是用 Docker 打包的贪吃蛇,因为我可以轻松地在命令行中运行,而不用担心发行版相关的问题。这个版本使用 15 个随机的食物 emoji 图案让蛇来吃。我玩得不好。不管怎样,请试一下:
|
||||
|
||||
@ -27,7 +29,9 @@ $ docker run -ti dyego/snake-game
|
||||
```
|
||||
|
||||
这个贪吃蛇以 MIT 许可证开源,你可在 [Github][3] 取得源码。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif)
|
||||
|
||||
你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。
|
||||
|
||||
请查看昨天的玩具,[数字 2 的力量,Linux 的力量:在命令行中玩 2048][5],记得明天再来!
|
||||
@ -39,7 +43,7 @@ via: https://opensource.com/article/18/12/linux-toy-snake
|
||||
作者:[Jason Baker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -49,4 +53,4 @@ via: https://opensource.com/article/18/12/linux-toy-snake
|
||||
[2]: https://en.wikipedia.org/wiki/QBasic
|
||||
[3]: https://github.com/DyegoCosta/snake-game
|
||||
[4]: https://github.com/vattam/BSDGames
|
||||
[5]: https://opensource.com/article/18/12/linux-toy-2048
|
||||
[5]: https://opensource.com/article/18/12/linux-toy-2048
|
@ -1,15 +1,17 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-10437-1.html)
|
||||
[#]: subject: (The Linux command line can fetch fun from afar)
|
||||
[#]: via: (https://opensource.com/article/18/12/linux-toy-remote)
|
||||
[#]: author: (Jason Baker https://opensource.com/users/jason-baker)
|
||||
|
||||
能从远程获得乐趣的 Linux 命令
|
||||
======
|
||||
使用这些工具从远程了解天气、阅读资料等。
|
||||
|
||||
> 使用这些工具从远程了解天气、阅读资料等。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi)
|
||||
|
||||
我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你有一直在看,如果没有,请回到[开始][1],从头看过来。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。
|
||||
@ -24,11 +26,11 @@
|
||||
$ telnet towel.blinkenlights.nl
|
||||
```
|
||||
|
||||
我第一次看到它是十年之前,因此我对于它还存在优点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。
|
||||
我第一次看到它是十年之前,因此我对于它还存在有点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png)
|
||||
|
||||
接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 **curl**(或者,**wget**)。
|
||||
接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 `curl`(或者,`wget`)。
|
||||
|
||||
```
|
||||
$ curl wttr.in
|
||||
@ -36,7 +38,7 @@ $ curl wttr.in
|
||||
|
||||
![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png)
|
||||
|
||||
最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,我被推荐过一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。
|
||||
最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,有人推荐给我一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。
|
||||
|
||||
你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。
|
||||
|
||||
@ -49,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-remote
|
||||
作者:[Jason Baker][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -60,4 +62,4 @@ via: https://opensource.com/article/18/12/linux-toy-remote
|
||||
[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line
|
||||
[4]: https://github.com/donnemartin/haxor-news
|
||||
[5]: https://github.com/michael-lazar/rtv
|
||||
[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl
|
||||
[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl
|
@ -1,3 +1,4 @@
|
||||
XYenChi is translating
|
||||
10 keys to quick game development
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb)
|
||||
|
@ -1,27 +1,27 @@
|
||||
LuMing is translating
|
||||
11 Methods To Find System/Server Uptime In Linux
|
||||
Linux 上查看系统/服务器运行时间的 11 种方法
|
||||
======
|
||||
Do you want to know, how long your Linux system has been running without downtime? when the system is up and what date.
|
||||
你是否想知道自己的 Linux 系统除宕机外正常运行了多长时间?系统什么时候启动以及现在的日期?
|
||||
|
||||
There are multiple commands is available in Linux to check server/system uptime and most of users prefer the standard and very famous command called `uptime` to get this details.
|
||||
Linux 上有多个查看服务器/系统运行时间的命令,大多数用户喜欢使用标准并且很有名的 `uptime` 命令获取这些具体的信息。
|
||||
|
||||
Server uptime is not important for some people but it’s very important for server administrators when the server running with mission-critical applications such as online shopping portal, netbanking portal, etc,.
|
||||
服务器的运行时间对一些用户来说不那么重要,但是当服务器运行诸如在线商城<ruby>门户<rt>portal</rt></ruby>、网上银行门户等<ruby>关键任务应用<rt>mission-critical applications</rt></ruby>时,它对于<ruby>服务器管理员<rt>server adminstrators</rt></ruby>来说就至关重要。
|
||||
|
||||
It must be zero downtime because if there is a down time then it will impact badly to million users.
|
||||
它必须做到 0 宕机,因为一旦停机就会影响到数百万用户。
|
||||
|
||||
As i told, many commands are available to check server uptime in Linux. In this tutorial we are going teach you how to check this using below 11 methods.
|
||||
正如我所说,许多命令都可以让用户看到 Linux 服务器的运行时间。在这篇教程里我会教你如何使用下面 11 种方式来查看。
|
||||
|
||||
Uptime means how long the server has been up since its last shutdown or reboot.
|
||||
<ruby>正常运行时间<rt>uptime</rt></ruby>指的是服务器自从上次关闭或重启以来经过的时间。
|
||||
|
||||
The uptime command the fetch the details from `/proc` files and print the server uptime, the `/proc` file is not directly readable by humans.
|
||||
`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,`/proc` 文件不能直接读取。
|
||||
|
||||
The below commands will print how long the system has been running and up. It also shows some additional information.
|
||||
以下这些命令会输出系统运行和启动的时间。也会显示一些额外的信息。
|
||||
|
||||
### Method-1 : Using uptime Command
|
||||
### 方法 1:使用 uptime 命令
|
||||
|
||||
uptime command will tell how long the system has been running. It gives a one line display of the following information.
|
||||
`uptime` 命令会告诉你系统运行了多长时间。它会用一行显示以下信息。
|
||||
|
||||
当前时间,系统运行时间,当前登录用户的数量,过去 1 分钟、5 分钟、15 分钟系统负载的均值。
|
||||
|
||||
The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.
|
||||
```
|
||||
# uptime
|
||||
|
||||
@ -29,10 +29,9 @@ The current time, how long the system has been running, how many users are curre
|
||||
|
||||
```
|
||||
|
||||
### Method-2 : Using w Command
|
||||
### 方法 2:使用 w 命令
|
||||
|
||||
w command provides a quick summary of every user logged into a computer, what each user is currently doing,
|
||||
and what load all the activity is imposing on the computer itself. The command is a one-command combination of several other Unix programs: who, uptime, and ps -a.
|
||||
`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:who,uptime,和 ps -a。
|
||||
```
|
||||
# w
|
||||
|
||||
@ -42,11 +41,11 @@ root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w
|
||||
|
||||
```
|
||||
|
||||
### Method-3 : Using top Command
|
||||
### 方法 3:使用 top 命令
|
||||
|
||||
Top command is one of the basic command to monitor real-time system processes in Linux. It display system information and running processes information like uptime, average load, tasks running, number of users logged in, number of CPUs & cpu utilization, Memory & swap information. Run top command then hit E to bring the memory utilization in MB.
|
||||
`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间,平均负载,运行的任务,登录用户数量,CPU 数量 & CPU 利用率,内存 & 交换空间信息。
|
||||
|
||||
**Suggested Read :** [TOP Command Examples to Monitor Server Performance][1]
|
||||
**推荐阅读:**[TOP 命令监视服务器性能的例子][1]
|
||||
```
|
||||
# top -c
|
||||
|
||||
@ -65,9 +64,10 @@ Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached
|
||||
|
||||
```
|
||||
|
||||
### Method-4 : Using who Command
|
||||
### 方法 4:使用 who 命令
|
||||
|
||||
`who` 命令列出当前登录进计算机的用户。`who` 命令与 `w` 命令类似,但后者还包含额外的数据和统计信息。
|
||||
|
||||
who command displays a list of users who are currently logged into the computer. The who command is related to the command w, which provides the same information but also displays additional data and statistics.
|
||||
```
|
||||
# who -b
|
||||
|
||||
@ -75,9 +75,10 @@ system boot 2018-04-12 02:48
|
||||
|
||||
```
|
||||
|
||||
### Method-5 : Using last Command
|
||||
### 方法 5:使用 last 命令
|
||||
|
||||
`last` 命令列出最近登录过的用户。`last` 往回查找 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。
|
||||
|
||||
The last command displays a list of last logged in users. Last searches back through the file /var/log/wtmp and displays a list of all users logged in (and out) since that file was created.
|
||||
```
|
||||
# last reboot -F | head -1 | awk '{print $5,$6,$7,$8,$9}'
|
||||
|
||||
@ -85,11 +86,12 @@ Thu Apr 12 02:48:04 2018
|
||||
|
||||
```
|
||||
|
||||
### Method-6 : Using /proc/uptime File
|
||||
### 方法 6:使用 /proc/uptime 文件
|
||||
|
||||
This file contains information detailing how long the system has been on since its last restart. The output of `/proc/uptime` is quite minimal.
|
||||
这个文件中包含系统上次启动后运行时间的详细信息。`/proc/uptime` 的输出相当精简。
|
||||
|
||||
第一个数字是系统自从启动的总秒数。第二个数字是总时间中系统空闲所花费的时间,以秒为单位。
|
||||
|
||||
The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds.
|
||||
```
|
||||
# cat /proc/uptime
|
||||
|
||||
@ -97,19 +99,21 @@ The first number is the total number of seconds the system has been up. The seco
|
||||
|
||||
```
|
||||
|
||||
# date -d “$(Method-7 : Using tuptime Command
|
||||
### 方法 7:使用 tuptime 命令
|
||||
|
||||
`tuptime` 是一个汇报系统运行时间的工具,输出历史信息并作以统计,保留重启之间的数据。和 `uptime` 命令很像,但输出更有意思一些。
|
||||
|
||||
Tuptime is a tool for report the historical and statistical running time of the system, keeping it between restarts. Like uptime command but with more interesting output.
|
||||
```
|
||||
$ tuptime
|
||||
|
||||
```
|
||||
|
||||
### Method-8 : Using htop Command
|
||||
### 方法 8:使用 htop 命令
|
||||
|
||||
htop is an interactive process viewer for Linux which was developed by Hisham using ncurses library. Htop have many of features and options compared to top command.
|
||||
`htop` 是运行在 Linux 上一个由 Hisham 使用 ncurses 库开发的交互式进程查看器。`htop` 比起 `top` 有很多的特性和选项。
|
||||
|
||||
**推荐阅读:** [使用 Htop 命令监控系统资源][2]
|
||||
|
||||
**Suggested Read :** [Monitor system resources using Htop command][2]
|
||||
```
|
||||
# htop
|
||||
|
||||
@ -126,13 +130,13 @@ htop is an interactive process viewer for Linux which was developed by Hisham us
|
||||
|
||||
```
|
||||
|
||||
### Method-9 : Using glances Command
|
||||
### 方法 9:使用 glances 命令
|
||||
|
||||
Glances is a cross-platform curses-based system monitoring tool written in Python. We can say all in one place, like maximum of information in a minimum of space. It uses psutil library to get information from your system.
|
||||
`glances` 是一个跨平台基于 curses 使用 python 写的监控工具。我们可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。
|
||||
|
||||
Glances capable to monitor CPU, Memory, Load, Process list, Network interface, Disk I/O, Raid, Sensors, Filesystem (and folders), Docker, Monitor, Alert, System info, Uptime, Quicklook (CPU, MEM, LOAD), etc,.
|
||||
`glances` 可以监控 CPU,内存,负载,进程,网络接口,磁盘 I/O,<ruby>磁盘阵列<rt>RAID</rt></ruby>,传感器,文件系统(与文件夹),容器,显示器,Alert 日志,系统信息,运行时间,<ruby>快速查看<rt>Quicklook</rt></ruby>(CPU,内存等)。
|
||||
|
||||
**Suggested Read :** [Glances (All in one Place)– An Advanced Real Time System Performance Monitoring Tool for Linux][3]
|
||||
**推荐阅读:** [Glances (集大成)– Linux 上高级的实时系统运行监控工具][3]
|
||||
```
|
||||
glances
|
||||
|
||||
@ -157,9 +161,10 @@ sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox
|
||||
|
||||
```
|
||||
|
||||
### Method-10 : Using stat Command
|
||||
### 方法 10:使用 stat 命令
|
||||
|
||||
`stat` 命令显示指定文件或文件系统的详细状态。
|
||||
|
||||
stat command displays the detailed status of a particular file or a file system.
|
||||
```
|
||||
# stat /var/log/dmesg | grep Modify
|
||||
|
||||
@ -167,9 +172,10 @@ Modify: 2018-04-12 02:48:04.027999943 -0400
|
||||
|
||||
```
|
||||
|
||||
### Method-11 : Using procinfo Command
|
||||
### 方法 11:使用 procinfo 命令
|
||||
|
||||
`procinfo` 从 `/proc` 文件夹下收集一些系统数据并将其很好的格式化输出在标准输出设备上。
|
||||
|
||||
procinfo gathers some system data from the /proc directory and prints it nicely formatted on the standard output device.
|
||||
```
|
||||
# procinfo | grep Bootup
|
||||
|
||||
@ -183,7 +189,7 @@ via: https://www.2daygeek.com/11-methods-to-find-check-system-server-uptime-in-l
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[LuuMing](https://github.com/LuuMing)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (zhs852)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
@ -7,96 +7,93 @@
|
||||
[#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux
|
||||
Termtosvg – 将你在 Linux 终端中操作录制成 SVG 动画
|
||||
======
|
||||
|
||||
By default everyone prefer history command to review/recall the previously entered commands in terminal.
|
||||
一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。
|
||||
|
||||
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 中,有许多可以用来记录终端活动的实用工具。
|
||||
|
||||
This tool will help us to record the users terminal activity, also will help us to identify other useful information from the output.
|
||||
这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。
|
||||
|
||||
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]** and **[Terminalizer Tool][2]**.
|
||||
如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 **[Script Command][1]** 和 **[Terminalizer Tool][2]**。
|
||||
|
||||
But if you are looking for **[GIF Recorder][3]** then try **[Gifine][4]** , **[Kgif][5]** and **[Peek][6]** utilities.
|
||||
不过,如果你在寻找 **[GIF 录制器][3]** ,你可以尝试 **[Gifine][4]** 、**[Kgif][5]** 和 **[Peek][6]** 。
|
||||
|
||||
Script is one of the best utility to record your terminal session on headless server.
|
||||
脚本是在无头服务器中记录终端活动的最佳方式之一。
|
||||
|
||||
Script is a Unix command line utility that records a terminal session (in other terms, It’s record everything displayed on your terminal).
|
||||
脚本是记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。
|
||||
|
||||
It stores the output in the current directory as a text file and the default file name is typescript.
|
||||
它会在当前工作目录下以文本文件方式储存所有终端输出。
|
||||
|
||||
### What is Termtosvg
|
||||
### 什么是 Termtosvg
|
||||
|
||||
Termtosvg is a Unix terminal recorder written in Python that renders your command line sessions as standalone SVG animations.
|
||||
Termtosvg 是一个用 Python 编写的 Unix 终端录制器,它可以将你的命令行会话保存为 SVG 动画。
|
||||
|
||||
### Termtosvg Features
|
||||
### Termtosvg 的特点
|
||||
|
||||
* Produce lightweight and clean looking animations embeddable on a project page.
|
||||
* Custom color themes, terminal UI and animation controls via SVG templates.
|
||||
* Compatible with asciinema recording format.
|
||||
* It requires Python >= 3.5
|
||||
* 可以制作用于某个项目主页且简洁美观的动画。
|
||||
* 可以在 SVG 模板中自定义配色、终端 UI 和动画。
|
||||
* 兼容 asciinema 录制格式。
|
||||
* 要求 Python 版本为 3.5 或更高。
|
||||
|
||||
### 如何在 Linux 中安装 Termtosvg
|
||||
|
||||
它是用 Python 编写的,所以我推荐使用 pip 来安装它。
|
||||
|
||||
请确保你已经安装了 **python-pip** 包。如果你还没安装,请输入下面的命令。
|
||||
对于 Debian 或 Ubuntu 用户,请使用 **[apt][7]** 或 **[apt-get][8]** 来安装 pip。
|
||||
|
||||
### How to Install Termtosvg In Linux
|
||||
|
||||
It was written in Python and pip installation is a recommended method to install Termtosvg on Linux.
|
||||
|
||||
Make sure you should have installed python-pip package on your system. If no, use the following command to install it.
|
||||
|
||||
For Debian/Ubuntu users, use **[Apt Command][7]** or **[Apt-Get Command][8]** to install pip package.
|
||||
|
||||
```
|
||||
$ sudo apt install python-pip
|
||||
```shell
|
||||
sudo apt install python-pip
|
||||
```
|
||||
|
||||
For Archlinux users, use **[Pacman Command][9]** to install pip package.
|
||||
对于 Archlinux 用户,请使用 **[pacman][9]** 来安装 pip。
|
||||
|
||||
```
|
||||
$ sudo pacman -S python-pip
|
||||
```shell
|
||||
sudo pacman -S python-pip
|
||||
```
|
||||
|
||||
For Fedora users, use **[DNF Command][10]** to install pip package.
|
||||
对于 Fedora 用户,请使用 **[dnf][10]** 来安装 pip。
|
||||
|
||||
```
|
||||
$ sudo dnf install python-pip
|
||||
```shell
|
||||
sudo dnf install python-pip
|
||||
```
|
||||
|
||||
For CentOS/RHEL users, use **[YUM Command][11]** to install pip package.
|
||||
对于 CentOS 或 RHEL 用户,请使用 **[yum][11]** 来安装 pip。
|
||||
|
||||
```
|
||||
$ sudo yum install python-pip
|
||||
```shell
|
||||
sudo yum install python-pip
|
||||
```
|
||||
|
||||
For openSUSE users, use **[Zypper Command][12]** to install pip package.
|
||||
对于 openSUSE 用户,请使用 **[zypper][12]** 来安装 pip。
|
||||
|
||||
```
|
||||
$ sudo zypper install python-pip
|
||||
```shell
|
||||
sudo zypper install python-pip
|
||||
```
|
||||
|
||||
Finally run the following **[pip command][13]** to install Termtosvg tool in Linux.
|
||||
最后,请执行 **[pip][13]** 来安装 Termtosvg。
|
||||
|
||||
```
|
||||
$ sudo pip3 install termtosvg pyte python-xlib svgwrite
|
||||
```shell
|
||||
sudo pip3 install termtosvg pyte python-xlib svgwrite
|
||||
```
|
||||
|
||||
### How to Record Your Terminal Session Using Termtosvg
|
||||
### 如何使用 Termtosvg
|
||||
|
||||
Once you successfully installed Termtosvg. Just run the following command to start recording.
|
||||
成功安装 Termtosvg 后,请使用以下命令来开始录制。
|
||||
|
||||
```
|
||||
```shell
|
||||
$ termtosvg
|
||||
Recording started, enter "exit" command or Control-D to end
|
||||
```
|
||||
|
||||
For testing purpose run few commands and see whether it’s working fine or not.
|
||||
如果只是想测试它是否正常工作,随意输入几行命令即可。
|
||||
|
||||
```
|
||||
```shell
|
||||
$ 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
|
||||
$ hostname
|
||||
@ -124,21 +121,21 @@ $ pip3 --version
|
||||
pip 18.1 from /usr/lib/python3.7/site-packages/pip (python 3.7)
|
||||
```
|
||||
|
||||
Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in `/tmp` folder with a unique name.
|
||||
完成后,你可以按下 `CTRL+D` 或输入 `exit` 来停止录制。录制完后,输出文件会以一个独一无二的名字被保存在 `/tmp` 文件夹中。
|
||||
|
||||
```
|
||||
```shell
|
||||
$ exit
|
||||
exit
|
||||
Recording ended, SVG animation is /tmp/termtosvg_5waorper.svg
|
||||
```
|
||||
|
||||
We can open the SVG file output with help of any web browser.
|
||||
我们可以在任意浏览器中打开 SVG 文件。
|
||||
|
||||
```
|
||||
$ firefox /tmp/termtosvg_5waorper.svg
|
||||
```shell
|
||||
firefox /tmp/termtosvg_5waorper.svg
|
||||
```
|
||||
|
||||
![][15]
|
||||
![最终效果][15]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -146,7 +143,7 @@ via: https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-ani
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[zhs852](https://github.com/zhs852)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user