Linux命令及Linux终端的20个趣事
1. 命令:sl (蒸汽機(jī)車)
你可能了解 ‘ls’ 命令,并經(jīng)常使用它來查看文件夾的內(nèi)容。但是,有些時(shí)候你可能會(huì)拼寫成 ‘sl’ ,這時(shí)我們應(yīng)該如何獲得一些樂趣而不是看見“command not found”呢?
安裝 sl
root@tecmint:~#?apt-get?install sl?(InDebian?like OS)
root@tecmint:~#?yum?-y install sl?(InRedHat?like OS)
輸出
root@tecmint:~#?sl
當(dāng)你敲入的是‘LS‘而不是’ls‘時(shí),這個(gè)命令也會(huì)運(yùn)行。
2. 命令:telnet
非也!非也!!這可不像它平常那樣復(fù)雜。你可能很熟悉telnet。Telnet 是一個(gè)文本化的雙向網(wǎng)絡(luò)協(xié)議。這里不需要安裝什么東西。你需要的就是一個(gè)Linux系統(tǒng)和一個(gè)連通的網(wǎng)絡(luò)。
root@tecmint:~#?telnet towel.blinkenlights.nl
3. 命令:fortune
試試你未知的運(yùn)氣,終端里有時(shí)也有好玩的。
安裝 fortune
root@tecmint:~#?apt-get?install fortune?(for?aptitude based system)
root@tecmint:~#?yum install fortune?(for?yum based system)
root@tecmint:~#?fortune
You're not my type. For that matter, you're?not?even?my?species!!!
Future?looks spotty.You?will spill soup?in?late evening.
You?worry too much about your job.Stop?it.You?are?not?paid enough to worry.
Your?love life will be...?interesting.
4. 命令:rev(翻轉(zhuǎn))
它會(huì)把傳遞給它的的每個(gè)字符串都反過來,是不是很好玩。
root@tecmint:~#?rev
123abc
cba321
xuniL eb ot nrob
born to be?Linux
5. 命令:factor
該談點(diǎn)兒關(guān)于Mathematics的了,這個(gè)命令輸出給定數(shù)字的所有因子。
root@tecmint:~#?factor
5
5:5
12
12:223
1001
1001:71113
5442134
5442134:22721067
6.命令:script
好的,這不是什么命令,而是一個(gè)腳本,一個(gè)很有趣的腳本。
root@tecmint:~#for?i?in{1..12};dofor?j?in?$(seq?1?$i);do?echo?-ne $i x $j=$((i*j))\\t;done;?echo;done
1?x?1=1
2?x?1=22?x?2=4
3?x?1=33?x?2=63?x?3=9
4?x?1=44?x?2=84?x?3=124?x?4=16
5?x?1=55?x?2=105?x?3=155?x?4=205?x?5=25
6?x?1=66?x?2=126?x?3=186?x?4=246?x?5=306?x?6=36
7?x?1=77?x?2=147?x?3=217?x?4=287?x?5=357?x?6=427?x?7=49
8?x?1=88?x?2=168?x?3=248?x?4=328?x?5=408?x?6=488?x?7=568?x?8=64
9?x?1=99?x?2=189?x?3=279?x?4=369?x?5=459?x?6=549?x?7=639?x?8=729?x?9=81
10?x?1=1010?x?2=2010?x?3=3010?x?4=4010?x?5=5010?x?6=6010?x?7=7010?x?8=8010?x?9=9010?x?10=100
11?x?1=1111?x?2=2211?x?3=3311?x?4=4411?x?5=5511?x?6=6611?x?7=7711?x?8=8811?x?9=9911?x?10=11011?x?11=121
12?x?1=1212?x?2=2412?x?3=3612?x?4=4812?x?5=6012?x?6=7212?x?7=8412?x?8=9612?x?9=10812?x?10=12012?x?11=13212?x?12=144
7.命令:Cowsay
一個(gè)在終端用ASCII碼組成的小牛,這個(gè)小牛會(huì)說出你想要它說的話。
安裝Cowsay
root@tecmint:~#?apt-get?install cowsay?(forDebian?based OS)
root@tecmint:~#?yum install cowsay?(forRedHat?based OS)
輸出
root@tecmint:~#?cowsay I?Love?nix
____________
<?I?Love?nix?>
------------
\?^__^
\?(oo)\_______
(__)\?)\/\
||----w?|
||||
如果用管道將‘fortune command’命令重定向到cowsay會(huì)怎樣呢?
root@tecmint:~# fortune | cowsay
_________________________________________
/?Q:How?many?Oregonians?does it take to \
|?screw?in?a light bulb??A:Three.One?to?|
|?screw?in?the light bulb?and?two to fend?|
|?off all those?|
||
|Californians?trying to share the?|
\ experience./
-----------------------------------------
\?^__^
\?(oo)\_______
(__)\?)\/\
||----w?|
||||
提示:‘|’是管道命令符。通常它是將一個(gè)命令的輸出作為下一個(gè)命令的輸入。在上面的例子中‘fortune’的輸出作為‘cowsay’命令的輸出。管道命令會(huì)經(jīng)常用在腳本和程序編寫中。
xcowsay是一個(gè)圖形界面程序。它與cowsay類似只是以一種圖形的方式來表達(dá),可以說是X版本的cowsay。
apt-get?insatll xcowsay
yum install xcowsay
輸出
root@tecmint:~#?xcowsay I?Love?nix
cowthink是另一個(gè)命令。運(yùn)行“cowthink Linux is sooo funny ”看看它與cowsay的不同吧。
apt-get?insatll cowthink
yum install cowthink
輸出
root@tecmint:~#?cowthink?....Linuxis?sooo funny
_________________________
(....Linuxis?sooo funny?)
-------------------------
o?^__^
o?(oo)\_______
(__)\?)\/\
||----w?|
||||
8. 命令:yes
yes 是一個(gè)非常有趣又有用的命令,尤其對(duì)于腳本編寫和系統(tǒng)管理員來說,它可以自動(dòng)地生成預(yù)先定義的響應(yīng)或者將其傳到終端。
root@tecmint:~#?yes I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
I?LoveLinux
提示: (直到你按下ctrl+c才停止)
9. 命令: toilet
什么?你在開玩笑嗎! 當(dāng)然沒有,但肯定的是這個(gè)命令的名字太搞了,我也不知道這個(gè)命令的名字從何而來。
安裝toilet
root@tecmint:~#?apt-get?install toilet
root@tecmint:~#?yum install toilet
輸出
root@tecmint:~#?toilet tecmint
mmmmmmm?" m
# mmm mmm mmmmm mmm m mm mm#mm mmm mmm mmmmm
# #"# #" " # # # # #" # # #" " #" "# # # #
# #"""" # # # # # # # # # # # # # #
# "#mm" "#mm" # # # mm#mm # # "mm # "#mm" "#m#" # # #
這個(gè)命令甚至提供了一些顏色和字體格式。
root@tecmint:~#?toilet?-f mono12?-F metal?Tecmint.com
提示:Figlet?是另外一個(gè)與toilet產(chǎn)生的效果類似的命令。
10. 命令:cmatrix
你可能看多好萊塢的電影‘***帝國’并陶醉于被賦予Neo的能看到在矩陣中任何事物的能力,或者你會(huì)想到一幅類似于‘Hacker’的桌面的生動(dòng)畫面。
安裝 cmatrix
root@tecmint:~#?apt-get?install cmatrix
root@tecmint:~#?yum install cmatrix
輸出
root@tecmint:~#?cmatrix
11. 命令: oneko
可能你堅(jiān)信Linux的鼠標(biāo)指針永遠(yuǎn)是同樣的黑色或白色一點(diǎn)兒也不生動(dòng),那你就錯(cuò)了。“oneko”是一個(gè)會(huì)讓一個(gè)“Jerry”你的鼠標(biāo)指針附著到你鼠標(biāo)上的一個(gè)軟件包。
安裝 oneko
root@tecmint:~#?apt-get?install oneko
root@tecmint:~#?yum install oneko
輸出
root@tecmint:~#?oneko
提示:關(guān)閉運(yùn)行著oneko的終端時(shí),Jerry也會(huì)隨之消失,重新啟動(dòng)終端時(shí)也不會(huì)再出項(xiàng)。你可以將這個(gè)程序添加到啟動(dòng)選項(xiàng)中然后繼續(xù)使用它。
12. Fork×××
這是一段非常欠抽的代碼。運(yùn)行這個(gè)命令的后果自己負(fù)責(zé)。這個(gè)命令其實(shí)是一個(gè)fork×××,它會(huì)以指數(shù)級(jí)的自乘,直到所有的系統(tǒng)資源都被利用了或者系統(tǒng)掛起(想要見識(shí)這個(gè)命令的威力你可以試一次這個(gè)命令,但是后果自負(fù),記得在運(yùn)行它之前關(guān)掉并保存其它所有程序和文件)。
root@tecmint:~#:(){:|:&}:
13. 命令:while
下面的”while“命令是一個(gè)腳本,這個(gè)腳本可以為你提供彩色的日期和文件直到你按下中斷鍵(ctrl+c)。復(fù)制粘貼這個(gè)命令到你的終端。
root@tecmint:~#whiletrue;do?echo?"$(date '+%D %T' | toilet -f term -F border --gay)";?sleep?1;done
提示:以上腳本通過下面的修改也會(huì)產(chǎn)生類似的輸出但是還是有點(diǎn)不同的,在你的終端試試吧。
root@tecmint:~#whiletrue;do?clear;?echo?"$(date '+%D %T' | toilet -f term -F border --gay)";?sleep?1;done
14. 命令: espeak
將你的多媒體音箱的音量調(diào)到最大,然后在將這個(gè)命令復(fù)制到你的終端,來看看你聽到上帝的聲音時(shí)的反應(yīng)吧。
安裝 espeak
root@tecmint:~#?apt-get?install espeak
root@tecmint:~#?yum install espeak
輸出
root@tecmint:~#?espeak?"Tecmint is a very good website dedicated to Foss Community"
15. 命令: aafire
在你的終端放一把火如何。把這個(gè)“aafire”敲到你的終端,不需要什么引號(hào)看看這神奇的一幕吧。按下任意鍵中指該程序。
安裝 aafire
root@tecmint:~#?apt-get?install libaa-bin
輸出
root@tecmint:~#?aafire
16. 命令: bb
首先安裝“apt-get install bb”,然后敲入“bb”看看會(huì)發(fā)生什么吧。
root@tecmint:~#?bb
17. 命令: url
如果在你的朋友面前用命令行來改變你的?twitter status?會(huì)不會(huì)很酷呢。用你的用戶名密碼和你想要的狀態(tài)分別替換username, password?和“your status message“就可以了。
root@tecmint:~#?url?-u?YourUsername:YourPassword-d status="Your status message"?http://twitter.com/statuses/update.xml
18. ASCIIquarium
想要在終端弄一個(gè)水族館該,怎么辦?
root@tecmint:~#?apt-get?install libcurses-perl
root@tecmint:~#?cd?/tmp
root@tecmint:~#?wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
root@tecmint:~#?tar?-zxvf?Term-Animation-2.4.tar.gz
root@tecmint:~#?cd?Term-Animation-2.4/
root@tecmint:~#?perl?Makefile.PL?&&?make?&&?make test
root@tecmint:~#?make install
安裝 ASCIIquarium
下載并安裝ASCIIquarium。
root@tecmint:~#?cd?/tmp
root@tecmint:~#?wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
root@tecmint:~#?tar?-zxvf asciiquarium.tar.gz
root@tecmint:~#?cd asciiquarium_1.1/
root@tecmint:~#?cp asciiquarium?/usr/local/bin
root@tecmint:~#?chmod?0755/usr/local/bin/asciiquarium
最后在終端運(yùn)行“asciiquarium”或者“/usr/local/bin/asciiquarium”,記得不要加引號(hào),神奇的一幕將在你眼前展現(xiàn)。
root@tecmint:~#?asciiquarium
19. 命令: funny manpages
首先安裝“apt-get install funny-manpages”然后運(yùn)行下面命令的man手冊(cè)。其中一些
baby
celibacy
condom
date
echo
flame
flog
gong
grope,?egrope,?fgrope
party
rescrog
rm
rtfm
tm
uubp
woman?(undocumented)
xkill
xlart
sex
strfry
root@tecmint:~#?man baby
20. Linux Tweaks
該到了做一些優(yōu)化的時(shí)候了
root@tecmint:~#?world
bash:?world:not?found
root@tecmint:~#?touch girls\ boo**
touch:?cannot touch?`girls boo**`:Permission?denied
root@tecmint:~#?nice man woman
No?manual entry?for?woman
root@tecmint:~#^How?did the sex change operation go?^
bash::s^How?did the sex change operation go?^:?substitution failed
root@tecmint:~#%blow
bash:?fg:%blow:no?such job
root@tecmint:~#?make love
make:***No?rule to make target?`love`.Stop.
$?[?whereis?my?brain?
sh:2:[:?missing?]
%?man:?why did you?get?a divorce?
man::Too?many arguments.
%!:say,?what?is?saccharine?
Bad?substitute.
server@localhost:/srv$ \(-
bash:(-:?command?not?found
Linux總是sexy:who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep(如果你知道我的意思,汗!)
還有一些其它的命令,只是這些命令并不能在所有的系統(tǒng)上運(yùn)行,所以本文沒有涉及到。比如說dog , filter, banner
使用愉快,你可以稍后再對(duì)我說謝謝:)您的評(píng)價(jià)是我們前進(jìn)的不竭動(dòng)力。告訴我們你最喜歡的命令。繼續(xù)關(guān)注,不久我會(huì)有另一篇值得閱讀的文章。
轉(zhuǎn)載于:https://blog.51cto.com/moerjinrong/1900941
總結(jié)
以上是生活随笔為你收集整理的Linux命令及Linux终端的20个趣事的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: TensorFlow与主流深度学习框架对
- 下一篇: Android RecyclerView