在 Linux 命令行中观看彩虹猫来稍事休息
彩虹猫

> 
> 你甚至可以在终端里欣赏彩虹猫。
> 
> 
> 


![](/data/attachment/album/201812/30/111259x9ssj5a9881a1h88.png)


今天是《Linux 命令行小玩具介绍》的第六天。在本系列文章中，我们将会探索一些娱乐用途（甚至有时完全没用）的 Linux 命令行小玩具。所有我们介绍的小玩具都是开源的。


也许你会问，它们都很独特吗？是的。不过，它们对你是否独特，我就不知道了。但是，我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。


从[昨天的选题](https://opensource.com/article/18/12/linux-toy-lolcat)继续：我们谈到了猫和彩虹。不过，在 Linux 命令行下有更有趣的彩虹和猫结合的程序吗？答案是肯定的。


我们不妨看看之前可以在命令行中使用彩虹猫的方式吧。意料之中，2011 年发布的 [彩虹猫](https://en.wikipedia.org/wiki/Nyan_Cat) 可以用 `nyancat` 呈现在终端中。你想念这只曾火遍网络的彩虹猫吗？看看下面这个视频记录吧，我会等你看完的。






现在，让我们在终端中重新感受这个令人惊奇的体验吧。`nyancat` 包正在很多发行版上（比如 Arch、Debian、Gentoo、Ubuntu 等等……）都有，不过我的系统（Fedora）没有，但是我们仍然可以很轻松地从源码编译它。


根据读者的一个很好的提醒，对于我来说，这应该在该系列中提及：要警惕从不受信任的来源安装应用程序，或者编译和运行你在网上找到的任何代码，就像你在这样的文章中找到这个一样。如果您不确定，请采取适当的预防措施，特别是如果您在生产机器上。


从这里克隆源代码：



```
git clone https://github.com/klange/nyancat.git
```

然后使用 `make` 编译，并用 `./nyancat` 来运行。


这直接为我带来了彩虹猫体验，甚至还有个计时器来显示我享受 “彩虹猫魔法”的时间。


![](/data/attachment/album/201812/30/111303gch9gd4z9ck4bdeo.gif)


你可以在 [GitHub](https://github.com/klange/nyancat) 上找到 `nyancat` 的源码，它正以 [NCSA 许可证](http://en.wikipedia.org/wiki/University_of_Illinois/NCSA_Open_Source_License) 开源。


命令行版本的彩虹猫可在[这个公共 Telnet 服务器上访问](http://nyancat.dakko.us/)（或者用另外一个猫 [netcat](http://netcat.sourceforge.net/) 也行），所以理论上来说你不必安装它。不过不幸的是，由于带宽限制，该服务器目前已经被关闭了。尽管如此，在各种老设备上连接老 Telnet 服务器上运行彩虹猫的[照片](http://nyancat.dakko.us/)还是值得一看的，说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢（如果你真的搭建了，请务必告知作者，万一他们可能会向公众分享呢？）。


你想让我介绍一下你最喜爱的命令行玩具吗？请在原文下留言，作者会考虑介绍的。


瞧瞧我们昨天介绍的小玩意：[用 lolcat 为你的 Linux 终端增添些许色彩](https://opensource.com/article/18/12/linux-toy-lolcat)。明天再来看我们的下一篇文章吧！




---


via: <https://opensource.com/article/18/12/linux-toy-nyancat>


作者：[Jason Baker](https://opensource.com/users/jason-baker) 选题：[lujun9972](https://github.com/lujun9972) 译者：[zhs852](https://github.com/zhs852) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
We're now on day six of the Linux command-line toys advent calendar, where we explore some of the fun, entertaining, and in some cases, utterly useless toys available for your Linux terminal. All are available under an open source license.


Will they all be unique? Yes. Will they all be unique to you? I don't know, but, chances are you'll find at least one new toy to play with by the time our advent calendar is done.

Today's selection is a continuation on the [theme](https://opensource.com/article/18/12/linux-toy-lolcat) we started yesterday: cats and rainbows. Wait, there's more cat-related rainbow fun to be had at the Linux command line? You bet there is.

So let's make a throwback all the way to 2011's [Nyan Cat](https://en.wikipedia.org/wiki/Nyan_Cat) with a command-line toy call, not surprisingly, **nyancat**. Did you miss the cultural phenomenon that was Nyan Cat? Watch the embed below, I'll wait.

Now, let's recreate that amazing experience in your terminal. **Nyancat** is packaged for many distributions (Arch, Debian, Gentoo, Ubuntu, etc.) but not for mine (Fedora), but compiling from source was simple.

Per a great reminder from a reader, this would be a good point in the series for me to mention: be careful about installing applications from untrusted sources or compiling and running any piece code you find online, just because you find them in an article like this one. If you're not sure, use appropriate precautions, especially if you're on a production machine.

I cloned the source with:

`git clone https://github.com/klange/nyancat.git`


Then I used **make**** **to compile, and ran the application with **./nyancat**.

This launched straight into a **nyancat** experience complete with a counter of how long I had been enjoying the **nyancat** magic for.

![Linux toy: nyancat Linux toy: nyancat](https://opensource.com/sites/default/files/uploads/linux-toy-nyancat-animated.gif)

You can find the source for **nyancat** [on GitHub](https://github.com/klange/nyancat) under an [NCSA open source license](http://en.wikipedia.org/wiki/University_of_Illinois/NCSA_Open_Source_License).

The command-line version of Nyan Cat used to be [accessible by a public Telnet server](http://nyancat.dakko.us/) (or, for even more pun, with [netcat](http://netcat.sourceforge.net/)) so that you didn't even have to install it, but sadly was shut down due to bandwidth limitations. Nevertheless, the [gallery](http://nyancat.dakko.us/) from the old Telnet server running Nyan Cat on a variety of old devices is well-worth checking out, and maybe you'd like to do the community a favor by launching your own public mirror and letting the author know so that they may share it with the public yet again?

Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end.

Check out yesterday's toy, [Bring some color to your Linux terminal with lolcat](https://opensource.com/article/18/12/linux-toy-lolcat), and check back tomorrow for another!

## Comments are closed.