今天介紹一些有趣的linux shell命令,所有的命令都可以使用man + 命令名稱來查看完整的使用方法。
1,figlet 字符畫
figlet 可以將英文字符串以字符畫的形式輸出:
>>> figlet hello
_ _ _
| |__ ___| | | ___
| '_ \ / _ \ | |/ _ \
| | | | __/ | | (_) |
|_| |_|\___|_|_|\___/
2,toilet 字符畫
toilet 的功能跟figlet 類似,但輸出的字符畫的樣子不一樣,該命令還可以設(shè)置字體和顏色。
>>> toilet hi
# "
# mm mmm
#" # #
# # #
# # mm#mm
3,lolcat 字符畫加彩色
lolcat 命令可以將figlet 或toilet 的輸出加上顏色:

image.png
4,aafire 火焰
aafire 命令輸出由ASCII碼組成的火焰狀的字符,屏幕燃燒起來:
>>> aafire

20200409124346655.gif
5,fortune 隨機(jī)句子
fortune 命令隨機(jī)輸出名言或笑話:
>>> 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 重復(fù)輸出一句話
yes 命令重復(fù)輸出一句話:
>>> yes hello,world
hello,world
hello,world
hello,world
7,pi 圓周率
pi 命令輸出圓周率π,pi 數(shù)字 表示輸出多少位的π:
>>> pi 20
3.1415926535897932384
8,cal 日歷
cal 命令可以顯示日歷:
>>> cal
--------------------
April 2020
Su Mo Tu We Th Fr Sa
1 2 3 4
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 命令輸出一個(gè)小火車:
111111.gif
ls-h(中間沒有空格)可以看到一個(gè)無窮盡的火車:

image.png
10,cowsay 會(huì)說話的牛
cowsay 命令是一只會(huì)說話的cow,它能輸出很多種動(dòng)物。
>>> cowsay "我是一只小可愛~"
< 我是一只小可愛~ >
-----------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
cowsay -l可以輸出所有支持的小動(dòng)物:
>>> 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參數(shù)切換小動(dòng)物:
>>> cowsay -f duck "我是一只小鴨子"
________________
< 我是一只小鴨子 >
----------------
\
\
\ >()_
(__)__ _
xcowsay 命令是圖形化的cowsay。
11,cmatrix 黑客帝國
cmatrix 命令可以輸出黑客帝國 的效果:
image.png
cmatrix還有很多參數(shù)可以改變效果:

image.png
12,asciiquarium 水族館
asciiquarium 是一個(gè)水族館,相信肯定會(huì)驚艷到你。其安裝方法如下:
$ 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
安裝成功后,執(zhí)行asciiquarium命令:
2222222222.gif
13,asciiview 圖片轉(zhuǎn)換字符畫
asciiview 命令可以將任意圖片轉(zhuǎn)換成字符畫的形式輸出,安裝方法如下:
sudo apt-get install aview imagemagick
asciiview hepburn.pen
轉(zhuǎn)換一張赫本的圖片,效果如下:
image.png
14,bastet 俄羅斯方塊
這是一個(gè)命令行中的俄羅斯方塊,可以使用方向鍵來控制:
33333333333.gif
15,ninvaders 太空入侵者
這是一個(gè)太空入侵者游戲,按方向鍵可以移動(dòng),空格可以發(fā)射子彈:

44444444444.gif
還有很多這樣的命令行小游戲,這里不再一一演示,感興趣的可以自己嘗試一下:

image.png
(完。)
喜歡朋友可以幫忙點(diǎn)個(gè)贊,關(guān)注一下!