2

15个有趣好玩的linux shell命令

 2 years ago
source link: https://codeshellme.github.io/2020/04/funny-shell-cmd/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

今天介绍一些有趣的linux shell命令,所有的命令都可以使用man + 命令名称 来查看完整的使用方法。

1,figlet 字符画

figlet 可以将英文字符串字符画的形式输出:

>>> figlet hello
| |__ ___| | | ___
| '_ \ / _ \ | |/ _ \
| | | | __/ | | (_) |
|_| |_|\___|_|_|\___/

2,toilet 字符画

toilet 的功能跟figlet 类似,但输出的字符画的样子不一样,该命令还可以设置字体和颜色。

>>> toilet hi
# mm mmm
# # mm#mm

3,lolcat 字符画加彩色

lolcat 命令可以将figlettoilet 的输出加上颜色:

toilet hello| lolcat

输出如下:

4,aafire 火焰

aafire 命令输出由ASCII码组成的火焰状的字符,屏幕燃烧起来:

>>> aafire

5,fortune 随机句子

fortune 命令随机输出名言或笑话:

>>> fortune
Soap and education are not as sudden as a massacre, but they are more
deadly in the long run.
-- Mark Twain

fortune-zh 命令只输出中文:

>>> fortune-zh
天下大势,分久必合,合久必分。

6,yes 重复输出一句话

yes 命令重复输出一句话:

>>> yes hello,world
hello,world
hello,world
hello,world

7,pi 圆周率

pi 命令输出圆周率π,pi 数字 表示输出多少位的π:

>>> pi 20
3.1415926535897932384

8,cal 日历

cal 命令可以显示日历:

>>> cal
--------------------
April 2020
Su Mo Tu We Th Fr Sa
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30

9,sl 小火车

sl 命令输出一个小火车:

ls-h (中间没有空格)可以看到一个无穷尽的火车:

10,cowsay 会说话的牛

cowsay 命令是一只会说话的cow,它能输出很多种动物。

>>> cowsay "我是一只小可爱~"
< 我是一只小可爱~ >
-----------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |

cowsay -l 可以输出所有支持的小动物:

>>> cowsay -l
Cow files in /usr/share/cowsay/cows:
apt bud-frogs bunny calvin cheese cock cower daemon default dragon
dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu hellokitty kiss koala kosh luke-koala mech-and-cow milk
moofasa moose pony pony-smaller ren sheep skeleton snowman stegosaurus
stimpy suse three-eyes turkey turtle tux unipony unipony-smaller vader
vader-koala www

使用-f 参数切换小动物:

>>> cowsay -f duck "我是一只小鸭子"
________________
< 我是一只小鸭子 >
----------------
\ >()_
(__)__ _

xcowsay 命令是图形化的cowsay

11,cmatrix 黑客帝国

cmatrix 命令可以输出黑客帝国 的效果:

cmatrix 还有很多参数可以改变效果:

参数 含义
-a 异步滚动
-b 打开粗体字符
-B 所有字符为粗体
-o 使用旧式滚动模式
-C 切换颜色

12,asciiquarium 水族馆

asciiquarium 是一个水族馆,相信肯定会惊艳到你。其安装方法如下:

$ sudo apt-get install libcurses-perl
$ cd /tmp
$ wget --no-check-certificate http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
$ tar -zxvf Term-Animation-2.4.tar.gz
$ cd Term-Animation-2.4/
$ perl Makefile.PL && make && make test
$ sudo make install
$ cd /tmp
$ wget --no-check-certificate http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
$ tar -zxvf asciiquarium.tar.gz
$ cd asciiquarium_1.0/ # whatever the current version you got was
$ sudo cp asciiquarium /usr/local/bin
$ sudo chmod 0755 /usr/local/bin/asciiquarium

安装成功后,执行asciiquarium 命令:

13,asciiview 图片转换字符画

asciiview 命令可以将任意图片转换成字符画的形式输出,安装方法如下:

sudo apt-get install aview imagemagick
asciiview hepburn.pen

转换一张赫本的图片,效果如下:

14,bastet 俄罗斯方块

这是一个命令行中的俄罗斯方块,可以使用方向键来控制:

15,ninvaders 太空入侵者

这是一个太空入侵者游戏,按方向键可以移动,空格可以发射子弹:

还有很多这样的命令行小游戏,这里不再一一演示,感兴趣的可以自己尝试一下:

命令 含义
pacman4console 吃豆人
nsnake 贪吃蛇
greed 赢者通吃
bsdgames 空中塔台控制
bsdgames 双陆棋
moonbuggy 月球车
2048 命令行版2048

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK