mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-25 00:50:15 +08:00
translated
This commit is contained in:
parent
67cce02228
commit
33d1bde3e7
@ -1,81 +0,0 @@
|
||||
translating----geekpi
|
||||
|
||||
Add Rainbow Colors to Linux Command Output in Slow Motion
|
||||
============================================================
|
||||
|
||||
In this article, we will review a cool and simple way of giving a command screen output a rainbow colors and slowing down its output speed as well for one reason or the other.
|
||||
|
||||
The [lolcat program][2] is used for the above purpose. It basically functions by concatenating files, or standard input, to standard output in a similar way as the [cat command][3], overrides the default screen output color of a particular command and adds rainbow coloring to it.
|
||||
|
||||
### How to Install Lolcat Program in Linux
|
||||
|
||||
Lolcat program is available on almost all modern Linux distributions from its default repository, but the available version bit older. Alternatively you can install latest version of lolcat from git repository using this following guide.
|
||||
|
||||
1. [Install Lolcat to Output Rainbow Of Colors in Linux Terminal][1]
|
||||
|
||||
Once lolcat installed, the basic syntax for running lolcat is:
|
||||
|
||||
```
|
||||
$ lolcat [options] [files] ...
|
||||
```
|
||||
|
||||
It comes with several options that control its behavior, below are a few of the most considerable flags we will emphasis for the scope of this guide:
|
||||
|
||||
1. `-a` – passes every input line through an animation effect.
|
||||
2. `-d` – specifies the duration (number of steps before displaying next line) of the animation effect, the default value is 12.
|
||||
3. `-s` – it specifies the speed (frame rate- number of steps per second) of the animation effect, default value is 20.
|
||||
4. `-f` – enables forcing of coloring in case standard output is not a tty.
|
||||
|
||||
You can find more options in the lolcat man page:
|
||||
|
||||
```
|
||||
$ man lolcat
|
||||
```
|
||||
|
||||
### How to Use Lolcat in Linux
|
||||
|
||||
To use lolcat, simply pipe the output of any relevant command to it and watch the magic.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
$ ls -l | lolcat -as 25
|
||||
```
|
||||
|
||||
[
|
||||

|
||||
][4]
|
||||
|
||||
Besides you can alter the default speed, in the following command, we will use a relatively slow speed of 10steps per second:
|
||||
|
||||
```
|
||||
$ ls -l | lolcat -as 10
|
||||
```
|
||||
|
||||
You can use any command with lolcat display output in colorful fashion on Linux terminal, few commands say ps, date and cal as:
|
||||
|
||||
```
|
||||
$ ps | lolcat
|
||||
$ date | lolcat
|
||||
$ cal | lolcat
|
||||
```
|
||||
|
||||
In this article, we have looked at how to significantly reduce the speed of a command screen output and give it a rainbow coloring effect.
|
||||
|
||||
As usual, you can address to us any questions or comments concerning this article via the feedback section below. Lastly, you can mention to us any useful Linux commands you have discovered there.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/add-colors-to-command-output-terminal-linux/
|
||||
|
||||
作者:[ Aaron Kili ][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/lolcat-command-to-output-rainbow-of-colors-in-linux-terminal/
|
||||
[2]:http://www.tecmint.com/lolcat-command-to-output-rainbow-of-colors-in-linux-terminal/
|
||||
[3]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2016/12/Colorful-Linux-Terminal-Output.gif
|
@ -0,0 +1,79 @@
|
||||
缓慢输出Linux命令并用彩色显示
|
||||
============================================================
|
||||
|
||||
本篇中,我们会展示一个很酷及简单的方法在屏幕中显示彩色的输出,并且可以为了某个原因减慢输出的速度。
|
||||
|
||||
[lolcat命令][2]可以满足上面的需求。它基本上通过与[cat命令][3]类似的方式将文件或标准输入定向到标准输出来运行,覆盖特定命令的默认屏幕输出颜色,并为其添加彩色。
|
||||
|
||||
### 如何在Linux中安装lolcat程序
|
||||
|
||||
lolcat可以在大多数现在Linux发型版的默认仓库中得到,但是可用的版本有点老。你可以使用下面的指导来从git仓库中安装最新的lolcat版本。
|
||||
|
||||
1. [安装lolcat来在Linux中显示彩色输出][1]
|
||||
|
||||
lolcat安装后,基本的lolcat语法是:
|
||||
|
||||
```
|
||||
$ lolcat [options] [files] ...
|
||||
```
|
||||
|
||||
有几个选项可以控制它的行为,下面是一些我们在本指导中会强调的几个最重要的标志:
|
||||
|
||||
1. `-a` - 将每行输出都显示动态效果。
|
||||
2. `-d` – 指定动画效果间隔(显示下一行之前的帧),默认是12。
|
||||
3. `-s` – 它指定了动画效果的速度(帧速-每秒的帧),默认是20。
|
||||
4. `-f` – 强制显示彩色防止标准输出不是tty。
|
||||
|
||||
你可以在lolcat的man页可以找到更多的选项:
|
||||
|
||||
```
|
||||
$ man lolcat
|
||||
```
|
||||
|
||||
### 如何在Linux中使用lolcat
|
||||
|
||||
要使用lolcat,直接将相关命令的输出通过管道给lolcat,接着见证魔法。
|
||||
|
||||
比如:
|
||||
|
||||
```
|
||||
$ ls -l | lolcat -as 25
|
||||
```
|
||||
|
||||
[
|
||||

|
||||
][4]
|
||||
|
||||
除此之外你可以改变默认速度,在下面的命令中,我们会使用一个相对较慢的速度,每秒显示10帧:
|
||||
|
||||
```
|
||||
$ ls -l | lolcat -as 10
|
||||
```
|
||||
|
||||
你可以使用任何命令结合lolcat在Linux终端中输出彩色结果,比如ps、date和cal:
|
||||
|
||||
```
|
||||
$ ps | lolcat
|
||||
$ date | lolcat
|
||||
$ cal | lolcat
|
||||
```
|
||||
|
||||
本篇中,我们了解了如何显著减小屏幕输出的速度,并显示彩色效果。
|
||||
|
||||
通常上,你可以在下面的评论栏中留下任何关于本篇的问题或评论。最后,你可以留下任何你发现的有用命令。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/add-colors-to-command-output-terminal-linux/
|
||||
|
||||
作者:[ Aaron Kili ][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/lolcat-command-to-output-rainbow-of-colors-in-linux-terminal/
|
||||
[2]:http://www.tecmint.com/lolcat-command-to-output-rainbow-of-colors-in-linux-terminal/
|
||||
[3]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/
|
||||
[4]:http://www.tecmint.com/wp-content/uploads/2016/12/Colorful-Linux-Terminal-Output.gif
|
Loading…
Reference in New Issue
Block a user