@wxy
https://linux.cn/article-16422-1.html
This commit is contained in:
Xingyu Wang 2023-11-28 07:22:54 +08:00
parent 46ba4e3376
commit 89ca914b9b
2 changed files with 224 additions and 249 deletions

View File

@ -0,0 +1,224 @@
[#]: subject: "Fun With Cmatrix in Linux"
[#]: via: "https://itsfoss.com/using-cmatrix/"
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
[#]: collector: "lujun9972/lctt-scripts-1693450080"
[#]: translator: "ChatGPT"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-16422-1.html"
在 Linux 中玩乐Cmatrix 之旅
======
![][0]
> 玩得开心,安德森先生!
Cmatrix 是一款充满乐趣的 Linux 和 Unix 系统命令行程序。它可以模仿经典电影《<ruby>黑客帝国<rt>Matrix</rt></ruby>》系列中的场景,用绿色的字符流营造出雨一般的下落效果。
![Cmatrix 命令][1]
除了充满视觉冲击力的绿色字符流之外,你还可以发挥想象,利用这款有趣的命令做更多事情。
> 🚧 需要注意的是Cmatrix 是一个 CPU 密集型的命令,所以请慎重使用它。
### 如何在 Ubuntu 及其他 Linux 系统中安装 Cmatrix
Cmatrix 已经被收录在几乎所有主要的 Linux 发行版的官方库中。如果你是 Ubuntu 用户,可以通过如下命令来安装 Cmatrix
```
sudo apt install cmatrix
```
对于 Fedora 用户,应该使用以下命令进行安装:
```
sudo dnf install cmatrix
```
而对于 Arch Linux 用户,则可以使用 pacman 命令进行安装:
```
sudo pacman -S cmatrix
```
### Cmatrix 的基础应用
cmatrix 命令自身提供了丰富的选项,你可以自由改变默认的绿色字符流的外观呈现。
#### 加粗的字符
你可以选择使用 `-b` 选项,偶尔展示加粗的字符,
```
cmatrix -b
```
![加粗的 Cmatrix 字符][2]
或者,你也可以调整设置,让所有的字符都以加粗方式显示,
```
cmatrix -B
```
![全部显示为加粗的字符][3]
#### 异步滚动
默认情况下Cmatrix 会创建一个字符同步下落的显示。但如果你想看到一个更为动态、视觉上更吸引人的显示效果,就可以在代码中操控字符的下落速度。
你可以这样设置 Cmatrix让其进行异步滚动
```
cmatrix -a
```
#### 自定义字符下落速度
你想让字符下落的速度更快,或者更慢吗?只需在 Cmatrix 中做出微小改动,就可以实现。
如想让字符以更快的速度下落,你可以这样设定:
```
cmatrix -u 2
```
![字符快速下落][4]
在这里,默认的屏幕更新延迟是 4如果你把这个值降低那么字符下落的速度就会增加反之则会减慢。所以如果你想让 Cmatrix 以更慢的速度运行,你可以这样设置:
```
cmatrix -u 9
```
![字符慢速下落][5]
#### 自定义颜色
你可能想问,绿色能改吗?当然,你想变成紫色也行。
运行 Cmatrix 的时候,你可以自由调整它的颜色。只需要使用 `-C` 选项,然后在后面添加你想要的颜色,如下所示:
```
cmatrix -C magenta
```
![颜色变为洋红色][6]
你可以任选绿色(`green`)、红色(`red`)、蓝色(`blue`)、白色(`white`)、黄色(`yellow`)、青色(`cyan`)、洋红色(`magenta`)以及黑色(`black`)这些颜色。
#### 其他可选设置
选项 | 对应功能
---|---
`cmatrix -o` | 旧式滚动模式
`cmatrix -m` | Lambda 模式:把所有的字符变为 lambda 符号
`cmatrix -s` | 屏保模式:按键有就自动退出
`cmatrix -h` | 调出帮助手册
### 运行 Cmatrix 时的快捷键选项
就算在启动 Cmatrix 的时候你没有添加任何选项,你仍可以在实际运行中随时改变设置。下面就是一些可供你随时选择的选项。
#### 随时改变颜色
当然,你无需重新启动程序,就可以随时改变显示的颜色。但需要记住,不同的键位对应着不同的颜色。在 Cmatrix 未关闭的情况下,如果你按下了存储在键位上的指令,显示的颜色将会直接变更。
颜色 | 相应键位
---|---
红色 | `!`
绿色 | `@`
黄色 | `#`
蓝色 | `$`
洋红色 | `%`
青色 | `^`
白色 | `&`
黑色 | `)`
#### 自由调整更新速度
在 Cmatrix 运行的过程中,你可以按 `0``9` 的任何一位数字键来随意改变当前的更新速度。
此外Cmatrix 也有许多其他的选项可供你选择,你可以在命令的 man 页面里面找到它们。
```
man cmatrix
```
### 彩虹魔法Cmatrix 配合 lolcat
> 🚧 请注意Cmatrix 本身就是 CPU 密集型的命令,所以在使用其他命令操控它的时候需特别小心。
你可以将 Cmatrix 和 lolcat 结合在一起使用,以此营造出一种更加有趣的视觉效果。如果你是 Ubuntu 的用户,可以通过如下的命令来安装 lolcat
```
sudo apt install lolcat
```
安装完毕后,只需简单地通过管道将 Cmatrix 连接到 lolcat你便可以看到赏心悦目的彩虹效果了。
```
cmatrix | lolcat
```
![Cmatrix 配合 Lolcat 效果][7]
当然,你也可以尝试用 lolcat 来管理所有的 Cmatrix 的功能。
或者,你可以调出一个倾斜的彩虹条纹效果,为自己的视觉体验增添一些新花样。
```
cmatrix | lolcat -p 100
```
此外,只要轻轻一点,你就可以直接反转现有的背景和前景颜色,使你的终端完全沉浸在五彩斑斓之中。
```
cmatrix | lolcat -i
```
![Cmatrix 与反转颜色的 Lolcat][8]
### 终端界面的无尽可能
我知道 Cmatrix 不可能是 [最实用的 Linux 命令][9],但无可否认,它令人喜爱且同样能够带给你乐趣。难道你不想尝试更多和你的 Linux 系统之间的 [有趣交互][10] 吗?
就像 [Cowsay][11] 这样的命令,虽然简单,却欢乐无穷:
> **[哞~ 我的 Linux 终端里有头牛][11]**
这里还有更多玩法等待你去探索:
> **[在终端中享受乐趣的 13 种 Linux 命令][12]**
现在,玩得开心,安德森先生!
*题图MJ/9f9f8665-e5d0-47b5-9df0-b39abd9dca3d*
--------------------------------------------------------------------------------
via: https://itsfoss.com/using-cmatrix/
作者:[Sreenath][a]
选题:[lujun9972][b]
译者:[ChatGPT](https://linux.cn/lctt/ChatGPT)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sreenath/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/content/images/2023/10/Cmatrix.gif
[2]: https://itsfoss.com/content/images/2023/10/cmatrix-occasional-bold-characters.png
[3]: https://itsfoss.com/content/images/2023/10/cmatrix-all-bold-characters.png
[4]: https://itsfoss.com/content/images/2023/10/Cmatrix-fast.gif
[5]: https://itsfoss.com/content/images/2023/10/cmatrix-slow.gif
[6]: https://itsfoss.com/content/images/2023/10/cmatrix-magenta-color.png
[7]: https://itsfoss.com/content/images/2023/10/Cmatrix-with-lolcat.png
[8]: https://itsfoss.com/content/images/2023/10/cmatrix-with-inverse-colors.png
[9]: https://itsfoss.com/essential-ubuntu-commands/
[10]: https://itsfoss.com/funny-linux-commands/
[11]: https://linux.cn/article-15952-1.html
[12]: https://itsfoss.com/funny-linux-commands/
[0]: https://img.linux.net.cn/data/attachment/album/202311/28/072046sff97h9bfqvfq8va.png

View File

@ -1,249 +0,0 @@
[#]: subject: "Fun With Cmatrix in Linux"
[#]: via: "https://itsfoss.com/using-cmatrix/"
[#]: author: "Sreenath https://itsfoss.com/author/sreenath/"
[#]: collector: "lujun9972/lctt-scripts-1693450080"
[#]: translator: " "
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Fun With Cmatrix in Linux
======
Cmatrix is an entertaining command-line program for Linux and Unix systems. It gives a 'Matrix'-style display, where a rain of green characters streams down the screen, just like in the iconic Matrix film series.
![Cmatrix Command][1]
But other than this green streams of characters, you can do several other things with this interesting command.
🚧
Cmatrix is a CPU intensive command. So use this with caution.
### Install Cmatrix in Ubuntu and Other Linux systems
Cmatrix is available in the official repositories of almost all major Linux distributions. In Ubuntu, you can install Cmatrix using the command:
```
sudo apt install cmatrix
```
Fedora users should use:
```
sudo dnf install cmatrix
```
Arch Linux user can use pacman:
```
sudo pacman -S cmatrix
```
### Basic cmatrix options
The cmatrix command alone provides several options, to change the appearance of the default output, that is the green character streams.
#### Bold characters
You can either toggle the bold characters on using `-b` option, where you will find occasional bold characters,
```
cmatrix -b
```
![Cmatrix with Occasional Bold Characters][2]
or, turn all the characters to bold using:
```
cmatrix -B
```
![All Bold Characters][3]
#### Asynchronous scroll
The usual Cmatrix will create a display, where characters are falling down in a synchronous manner. In this mode, you can see a dynamic and visually engaging display, where the speed of the characters is varied.
To use Cmatrix in asynchronous scroll:
```
cmatrix -a
```
#### Change the speed of characters
Do you want to display the characters falling very fast, or very slow? You can do this in Cmatrix.
To make characters fall down fast, use:
```
cmatrix -u 2
```
![Characters Moving Fast][4]
Here, the default value of screen update delay is 4 and if you reduce it, the speed will be increased and vice versa. So, to run a slower cmatrix, use:
```
cmatrix -u 9
```
![Characters Moving Slow][5]
#### Use different Colors
Go green! Or perhaps go purple?
You can run Cmatrix with a different color. For this, you can use the `-C` option.
```
cmatrix -C magenta
```
![The color is Magenta][6]
The supported colors are **green, red, blue, white, yellow, cyan, magenta and black**.
#### Other Options
Option | Function
---|---
cmatrix -o | Old Style Scrolling
cmatrix -m | Lambda Mode: Every character becomes a lambda
cmatrix -s | Screensaver Mode: Exits on first keystroke
cmatrix -h | Help
### Cmatrix keystrokes during execution
Even if you dont provide any option in Cmatrix, you can provide some input later on during execution. Those are listed below.
#### Change Color
Yes, you can change the color of characters while running. But you need to remember some keys and their corresponding color. What to do is, while running Cmatrix, press these keys and the color will change.
Color | Keystroke
---|---
Red | !
Green | @
Yellow | #
Blue | $
Magenta | %
Cyan | ^
White | &
Black | )
#### Adjust update speed
While running, you can use the number keys from 0 through 9 to change the update speed.
There are other options also, which you can find from the man page of the command.
```
man cmatrix
```
### Bonus: Cmatrix with lolcat
🚧
Cmatrix itself is CPU intensive. So use the other commands with caution.
You can use Cmatrix, in combination with the lolcat command, to make it look more interesting. In Ubuntu, you can install lolcat using:
```
sudo apt install lolcat
```
Now, just pipe Cmatrix to lolcat so that you will get a rainbow effect.
```
cmatrix | lolcat
```
![Cmatrix with Lolcat][7]
Also, try all the above functions of Cmatrix, while piping into lolcat.
Or, you can use an inclined stripe for a rainbow effect, giving another type of experience.
```
cmatrix | lolcat -p 100
```
Additionally, you can just invert the background and foreground colors so that your terminal will be filled with colors.
```
cmatrix | lolcat -i
```
![Cmatrix with Lolcat Inverted Color Option][8]
### More fun with terminal
I know this is not the [most useful Linux command][9] but it's fun nonetheless and you can have some [fun with your Linux system][10] sometime, right?
[Cowsay][11] is another such command:
![][12]
And even more here:
![][12]
I let you enjoy it now, Mr. Anderson.
--------------------------------------------------------------------------------
via: https://itsfoss.com/using-cmatrix/
作者:[Sreenath][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/sreenath/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/content/images/2023/10/Cmatrix.gif
[2]: https://itsfoss.com/content/images/2023/10/cmatrix-occasional-bold-characters.png
[3]: https://itsfoss.com/content/images/2023/10/cmatrix-all-bold-characters.png
[4]: https://itsfoss.com/content/images/2023/10/Cmatrix-fast.gif
[5]: https://itsfoss.com/content/images/2023/10/cmatrix-slow.gif
[6]: https://itsfoss.com/content/images/2023/10/cmatrix-magenta-color.png
[7]: https://itsfoss.com/content/images/2023/10/Cmatrix-with-lolcat.png
[8]: https://itsfoss.com/content/images/2023/10/cmatrix-with-inverse-colors.png
[9]: https://itsfoss.com/essential-ubuntu-commands/
[10]: https://itsfoss.com/funny-linux-commands/
[11]: https://itsfoss.com/cowsay/
[12]: https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png