Merge pull request #30121 from CoWave-Fall/Translation-20220706-ASCII-Art-Tools

[完成翻译] 20220706 10 Tools to Generate and Have Fun With ASCII Art in L…
This commit is contained in:
Xingyu.Wang 2023-09-17 09:19:54 +08:00 committed by GitHub
commit 6c75238256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,240 +2,239 @@
[#]: via: "https://itsfoss.com/ascii-art-linux-terminal/" [#]: via: "https://itsfoss.com/ascii-art-linux-terminal/"
[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" [#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/"
[#]: collector: "lkxed" [#]: collector: "lkxed"
[#]: translator: "泠知落汐" [#]: translator: " "
[#]: reviewer: " " [#]: reviewer: " "
[#]: publisher: " " [#]: publisher: " "
[#]: url: " " [#]: url: " "
10 Tools to Generate and Have Fun With ASCII Art in Linux Terminal 10 个在 Linux 终端中生成有趣的 ASCII 字符画的工具
====== ======
Linux terminal is not as scary as you think. Linux 终端其实没有想象中的那样可怕。
Of course, it could be intimidating in the beginning but once you [know the terminal better][1], you start loving it. 当然啦,一开始它可能会令人望而却步,但是当我们更了解它的时候,我们就会喜欢上它的。
You are likely to use the terminal for serious work. But there are many fun stuff you can do in the terminal as well. 你可能会使用终端来做一些严肃的工作。不过,你也可以在终端中做很多有趣的事情。
One of them is experimenting with ASCII art. You can display predefined or random messages, play games, or run some animation in ASCII format in the Linux terminal using various command line tools. 其中的一项就是试一试 ASCII 字符画。你可以在 Linux 终端中用各种命令行工具以 ASCII 的形式显示一些预定义的或是随机的消息,玩游戏,抑或是播放动画。
My teammate Sreenath likes to explore such unusual CLI tools and share his findings with me. I am sharing those findings with you. 我的队友 Sreenath 喜欢探索此类不寻常的命令行工具并将他的发现分享给我。现在,我也将他的发现与你分享。
![ascii art tools linux][2] ![ascii art tools linux][2]
Most of these programs should be available in the repositories of your Linux distribution. You can use your systems package manager to install them. To keep the article concise, I have only included the installation instructions for Ubuntu.
### 1. lolcat: Add colors to your terminal 你的 Linux 发行版的仓库中应该已经有这些程序中的大多数了。你可以用系统的包管理器安装它们。为了使文章简洁,下文的安装指南均以 Ubuntu 为例。
### 1. lolcat: 向终端加入缤纷色彩
Alright! lolcat doesnt have anything to do with ASCII art. At least not directly. 虽然 lolcat 与 ASCII 字符画没有任何关系,至少,没有直接关系。
Still, I included it at the beginning of this article because you can combine other ASCII tools with lolcat. 但是,我还是在文章开头就列出了它,因为它可以与其他的 ASCII 工具组合使用。
So, what does it do? It is similar to the cat command but it adds random gradient colors to its output. 所以,它能做什么呢?它与 cat 指令很相似,但是它向输出内容加入随机的渐变色彩。
![lolcat][3] ![lolcat][3]
It may not look useful at the moment but youll see its impact when the outputs of other ASCII tools are piped through lolcat. 目前它看起来可能没什么用,但当其他 ASCII 工具通过 lolcat 输出时,您会看到它的效果。
Install lolcat with the apt command: 用 apt 安装 lolcat
``` ```
sudo apt install lolcat sudo apt install lolcat
``` ```
### 2. Aewan: 漂亮地显示 ASCII 字符
### 2. Aewan: Display ASCII text beautifully Aewan 是一个多层 ASCII 图形、动画编辑器。它可以生成独立的,可被 cat 命令查看的 ASCII 字符画文件和便于命令行工具集成与解析的格式。
Aewan is a multi-layered ASCII graphics/animation editor. It produces stand-alone cat-able ASCII art files and an easy-to-parse format for integration into terminal applications. 它包括两个工具ASCII 编辑器 `aewan`,和文件查看器 `aecat`
It has two tools: `aewan`, an ASCII editor and `aecat`, for viewing the created file. 这里不讨论编辑器部分。
I am not going to discuss the editor part here. ![aewan 的初始状态布局][4]
![aewan initial layout][4] 用 aecat 命令以 ASCII 格式漂亮地显示任何文本。注意下面的截屏中字母的使用方式。
To display any text in pretty ASCII format, you need the aecat command. Notice the use of letters in the screenshot below.
![aewan output][5] ![aewan output][5]
To install aewan use the following command: 用下面的命令安装 aewan
``` ```
sudo apt install aewan sudo apt install aewan
``` ```
And then use it like this: 然后这样使用:
``` ```
aecat hello aecat hello
``` ```
### 3. Cowsay: Make an ASCII cow say whatever you want ### 3. Cowsay: 让 ASCII 牛复述你想说的话
What does the cow say? Whatever you want it to say. 牛说什么?你想什么就让它说什么。
The cowsay is already a popular tool among seasoned Linux users. It shows an ASCII cow that repeats the text you provide it. cowsay 是已经在经验丰富的 Linux 用户中流行的工具。它显示了一个 ASCII 牛,会重复你提供的文本。
![cowsay][6] ![cowsay][6]
But you are not restricted to cows only. You can change it to several other characters as well. Like a dragon (burning Kings landing): 但不仅限于牛。你也可以将其更改为其他的角色。比如,一条龙(火龙君临):
![cowsay][7] ![cowsay][7]
Did you notice the colored output in the above screenshot? Thats the magic of the lolcat command I mentioned earlier. 你注意到截图中的色彩了吗?这正是上文提到过的 lolcat 命令的魔力所在。
To install cowsay, use: 用下列命令安装 cowsay
``` ```
sudo apt install cowsay sudo apt install cowsay
``` ```
Once installed, you can use it like this: 装好之后,这样使用:
``` ```
cowsay hello cowsay hello
``` ```
You can refer to its [man page][8] for additional configuration and options. 你可以参考它的 [手册][8],浏览其他配置和选项。
### 4. jp2a: Convert images into ASCII art ### 4. jp2a: 图片转 ASCII 字符画
jp2a is a command-line tool that [converts images to ASCII art in the Linux terminal][9]. It works with JPEG and PNG files. It also allows colored output and your selection of character set to appear as ASCII image. jp2a 是一个在 Linux 终端中将图像转换为 ASCII 字符画的命令行工具。它适用于 JPEG 和 PNG 文件,允许彩色输出和用您选定的字符显示 ASCII 字符画。
![jp2a][10] ![jp2a][10]
You can install it using the following command: 用下列命令安装它:
``` ```
sudo apt install jp2a sudo apt install jp2a
``` ```
You can get the colorful output and save the ASCII text like this: 你可以像这样得到彩色的输出,并且保存到文件。
``` ```
jp2a --output=ascii.txt --colors input.png jp2a --output=ascii.txt --colors input.png
``` ```
Its not the only program of this kind. There is ascii-image-converter and several other tools that could be used for the same purpose. I wont discuss all of them in this list. 它并不是这类工具中的唯一一种比如ascii-image-converter 和几个其他的工具也可以达成相同的效果。在这里不再一一讨论了。
### 5. linuxlogo: Display the ASCII logo your Linux distro ### 5. linuxlogo: 用 ASCII 格式显示 Linux 发行版的徽标
The name says it all. It displays the [Linux logo in ASCII format][11]. 正如起名,它[用 ASCII 格式显示 Linux 发行版的标志][11]。
No, not our [beloved Linux logo, Tux][12] but the logo of your Linux distribution. It also shows a few additional information like [Linux kernel version][13], CPU, RAM, hostname, etc. 不,不是我们[喜爱的 Linux 标志 Tux][12],而是您的 Linux 发行版的徽标。它还显示一些其他信息,比如 Linux 内核版本、CPU、RAM、主机名等等。
![linux logo][14] ![linux logo][14]
You can install it using the apt command: 用 apt 安装:
``` ```
sudo apt install linuxlogo sudo apt install linuxlogo
``` ```
Just enter linuxlogo to use the command. 输入 linuxlogo 就可以用啦。
### 6. Neoftech: Display the Linux logo along with system info ### 6. Neoftech: 显示 Linux 标志和系统信息
The above linuxlogo command is too simplistic. You can amp it up by using Neofetch. 上面的 Linux 标志有点太简化了。你可以用 Neofetch 放大他。
It displays the distribution in a more pretty way along with several system information like kernel, uptime, desktop environment, theme, icons, etc. 它以更漂亮的方式显示发行版以及一些系统信息,如内核、运行时间、桌面环境、主题和图标等等。
![neofetch][15] ![neofetch][15]
You can also parse it through lolcat to get rainbow-colored output. 您还可以通过 lolcat 解析它,获得彩虹色的输出。
Install Neoftech using this command: 用这行命令安装 Neofetch
``` ```
sudo apt install neofetch sudo apt install neofetch
``` ```
And then just enter neoftech to run the command. 然后,输入 Neofetch 就可以运行啦。
There is also screenfetch, a similar tool to Neofetch. You can use either of them. 还有一个与 Neofetch 很像的工具screenfetch。用哪个都行。
### 7. fortune: Get your fortune told ### 7. fortune: 看看命运如何
Just kidding! Theres no such thing. 开玩笑啦。这样的事情根本就不存在。
However, fortune cookies are still fashionable and apparently, people like to read random predictions or teachings. 不过,幸运饼干仍然很流行,所以显然,人们喜欢阅读随机的预测或说法。
You can get a similar feature in the Linux terminal with the fortune command: 您可以在 Linux 终端中用 Fortune 命令达到类似效果:
![fortune cookie linux][16] ![fortune cookie linux][16]
You can install it using the following command: 你可以用下面的命令安装它。
``` ```
sudo apt install fortune sudo apt install fortune
``` ```
Once installed, just enter fortune in the terminal to get a random message. 装好之后,在终端中输入 fortunate 来得到一条随机消息。
### 8. pv: Make things animated ### 8. pv: Make things animated
This is a classic example of the unintended use of a Linux command. The pv command is used to monitor the progress of data through pipe. 这是非预期使用 Linux 命令的典型例子。pv 命令本来用于通过管道监控数据的进度。
But you can use it to animate the output of any command. Combine it with some of the above-mentioned commands and you can see the ASCII art appearing on your screen as if it is being typed. 但您可以使用它来对显示任何命令的输出加入动画效果。将其与上述的命令结合起来,您就可以看到 ASCII 字符画逐渐显现在屏幕上,就像正在输入一样。
Dont get it? Watch this video: 不太明白?看看这个:
![A Video from YouTube][17] ![A Video from YouTube][17]
Install it using the following command: 用下面的命令安装:
``` ```
sudo apt install pv sudo apt install pv
``` ```
And then use it in the following manner: 然后按这样使用:
``` ```
neofetch | pv -qL 200 | lolcat neofetch | pv -qL 200 | lolcat
``` ```
The higher the number, the higher will be the speed. 数字越大,速度越快。
### 9. cmatrix: Matrix like animation in ASCII ### 9. cmatrix: 类似黑客帝国的 ASCII 动画
Remember the cult geek move Matrix? The green falling code is synonymous with Matrix and hacking. 还记得 "黑客帝国 "吗?下落的绿色代码是黑客帝国和黑客的象征。
You can run an ASCII simulation of the falling code in the Linux terminal with cmatrix command. 您可以使用 cmatrix 命令在 Linux 终端用 ASCII 模拟运行下落代码。
I am sharing a screenshot instead of animation here. 我在这里用一张图片代替视频。
![cmatrix][18] ![cmatrix][18]
You can install it with apt command: 你可以用 apt 安装他:
``` ```
sudo apt install cmatrix sudo apt install cmatrix
``` ```
Once installed, you can run it with: 安装好之后,用它运行:
``` ```
cmatrix cmatrix
``` ```
It starts the animation immediately and it keeps on generating random green text falling and disappearing from the screen. The command keeps on running. To [stop the running application][19], use the Ctrl+C keys. 它会立即启动,并不断生成随机的绿色文本,带着从屏幕上落下后消失的动画效果。该命令会持续运行。使用 Ctrl+C 停止运行程序。
### 10. cbonsai: Grow a bonsai in your terminal ### 10. cbonsai: Grow a bonsai in your terminal
Got a green thumb? How about growing an ASCII bonsai tree in the terminal? 有没有园艺的天赋?在终端中种植一棵 ASCII 盆景树怎么样?
cbonsai is a [fun Linux command][20] that lets you run bonsai tree growing animation in ASCII format. cbonsai 是一个可让您以 ASCII 格式运行盆景树生长动画的有趣 Linux 命令。
I shared a YouTube Shorts of cbonsai command a few days ago. 几天前我发了一条关于 cbonsai 命令的 YouTube 短视频。
![Have fun with the Linux terminal 😍 🐧][21] ![Have fun with the Linux terminal 😍 🐧][21]
[Subscribe to our YouTube channel for more Linux videos][22] [订阅我们的 YouTube 频道,查看更多关于 Linux 的视频][22]
You can install cbonsai using: 你可以用下面的命令安装 cbonsai
``` ```
sudo apt install cbonsai sudo apt install cbonsai
``` ```
And then to run the animation, use this command: 用这行命令运行:
``` ```
cbonsai -l cbonsai -l
@ -243,17 +242,17 @@ cbonsai -l
### Try some more ### Try some more
There are many more such fun CLI tools. Heck, there are [ASCII games][23] as well. Its fun to use them at times to amuse people around you. 还有很多这样的有趣的命令行工具,甚至还有[ASCII 游戏][23]。有时,看着它们给周围的人带来欢乐真的很有趣。
Can you put these commands to some good use? Not certain about the usability, but you can add some of them in your .bashrc file so that the command is run as soon as you open a terminal session. 这些命令能派上用场吗?我不确定是否可用,但你可以在 .bashrc 文件中添加其中一些,这样一旦打开终端会话,命令就会立即运行。
Many sys-admins do that on shared Linux systems. A program like cowsay or figlet can be used to display a message or system info in a pretty way. 许多系统管理员在共享的 Linux 系统上都会这样做。像 cowsay 或 figlet 这样的程序可以用来以漂亮的方式显示消息或系统概况。
You may also use some of these programs in your bash scripts, especially if you have to highlight something. 您也可以在您的 bash 脚本中使用其中的一些程序,尤其是当您需要突出显示某些内容时。
There could be other usages of ASCII art in Linux. I let you share them with the rest of us here. ASCII 字符画在 Linux 中可能还会有其他用途。你可以与我们分享。
#### Read More Articles #### 阅读更多
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------