6.命令:script
好的,這不是什麼命令,而是一個腳本,一個很有趣的腳本。
- root@tecmint:~# for i in {1..12}; do for j in $(seq 1 $i); do echo -ne $i x $j=$((i*j))\\t;done; echo;done
- 1 x 11=1
- 2 x 1=2 2 x 2=4
- 3 x 1=3 3 x 2=6 3 x 3=9
- 4 x 1=4 4 x 2=8 4 x 3=12 4 x 4=16
- 5 x 1=5 5 x 2=10 5 x 3=15 5 x 4=20 5 x 5=25
- 6 x 1=6 6 x 2=12 6 x 3=18 6 x 4=24 6 x 5=30 6 x 6=36
- 7 x 1=7 7 x 2=14 7 x 3=21 7 x 4=28 7 x 5=35 7 x 6=42 7 x 7=49
- 8 x 1=8 8 x 2=16 8 x 3=24 8 x 4=32 8 x 5=40 8 x 6=48 8 x 7=56 8 x 8=64
- 9 x 1=9 9 x 2=18 9 x 3=27 9 x 4=36 9 x 5=45 9 x 6=54 9 x 7=63 9 x 8=72 9 x 9=81
- 10 x 1=10 10 x 2=20 10 x 3=30 10 x 4=40 10 x 5=50 10 x 6=60 10 x 7=70 10 x 8=80 10 x 9=90 10 x 10=100
- 11 x 1=11 11 x 2=22 11 x 3=33 11 x 4=44 11 x 5=55 11 x 6=66 11 x 7=77 11 x 8=88 11 x 9=99 11 x 10=110 11 x 11=121
- 12 x 1=12 12 x 2=24 12 x 3=36 12 x 4=48 12 x 5=60 12 x 6=72 12 x 7=84 12 x 8=96 12 x 9=108 12 x 10=120 12 x 11=132 12 x 12=144
7.命令:Cowsay
一個在終端用ASCII碼組成的小牛,這個小牛會說出你想要它說的話。
安裝Cowsay
- root@tecmint:~# apt-get install cowsay (for Debian based OS)
- root@tecmint:~# yum install cowsay (for Red Hat based OS)
輸出
- root@tecmint:~# cowsay I Love nix
- ____________
- < I Love nix >
- ------------
- \ ^__^
- \ (oo)\_______
- (__)\ )\/\
- ||----w |
- || ||
如果用管道將‘fortune command’命令重定向到cowsay會怎樣呢?
- 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 |
- || ||
提示:‘|’是管道命令符。通常它是將一個命令的輸出作爲下一個命令的輸入。在上面的例子中‘fortune’的輸出作爲‘cowsay’命令的輸出。管道命令會經常用在腳本和程序編寫中。
xcowsay是一個圖形界面程序。它與cowsay類似只是以一種圖形的方式來表達,可以說是X版本的cowsay。
- apt-get insatll xcowsay
- yum install xcowsay
輸出
- root@tecmint:~# xcowsay I Love nix
cowthink是另一個命令。運行“cowthink Linux is sooo funny ”看看它與cowsay的不同吧。
- apt-get insatll cowthink
- yum install cowthink
輸出
- root@tecmint:~# cowthink ....Linux is sooo funny
- _________________________
- ( ....Linux is sooo funny )
- -------------------------
- o ^__^
- o (oo)\_______
- (__)\ )\/\
- ||----w |
- || ||
8. 命令:yes
yes 是一個非常有趣又有用的命令,尤其對於腳本編寫和系統管理員來說,它可以自動地生成預先定義的響應或者將其傳到終端。
- root@tecmint:~# yes I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
- I Love Linux
提示: (直到你按下ctrl+c才停止)
9. 命令: toilet
什麼?你在開玩笑嗎! 當然沒有,但肯定的是這個命令的名字太搞了,我也不知道這個命令的名字從何而來。
安裝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#" # # #
這個命令甚至提供了一些顏色和字體格式。
- root@tecmint:~# toilet -f mono12 -F metal Tecmint.com
提示:Figlet 是另外一個與toilet產生的效果類似的命令。
10. 命令:cmatrix
你可能看多好萊塢的電影‘黑客帝國’並陶醉於被賦予Neo的能看到在矩陣中任何事物的能力,或者你會想到一幅類似於‘Hacker’的桌面的生動畫面。
安裝 cmatrix
- root@tecmint:~# apt-get install cmatrix
- root@tecmint:~# yum install cmatrix
輸出
- root@tecmint:~# cmatrix
11. 命令: oneko
可能你堅信Linux的鼠標指針永遠是同樣的黑色或白色一點兒也不生動,那你就錯了。“oneko”是一個會讓一個“Jerry”你的鼠標指針附着到你鼠標上的一個軟件包。
安裝 oneko
- root@tecmint:~# apt-get install oneko
- root@tecmint:~# yum install oneko
輸出
- root@tecmint:~# oneko
提示:關閉運行着oneko的終端時,Jerry也會隨之消失,重新啓動終端時也不會再出項。你可以將這個程序添加到啓動選項中然後繼續使用它。
12. Fork炸彈
這是一段非常欠抽的代碼。運行這個命令的後果自己負責。這個命令其實是一個fork炸彈,它會以指數級的自乘,直到所有的系統資源都被利用了或者系統掛起(想要見識這個命令的威力你可以試一次這個命令,但是後果自負,記得在運行它之前關掉並保存其它所有程序和文件)。
- root@tecmint:~# :(){ :|:& }:
13. 命令:while
下面的”while“命令是一個腳本,這個腳本可以爲你提供彩色的日期和文件直到你按下中斷鍵(ctrl+c)。複製粘貼這個命令到你的終端。
- root@tecmint:~# while true; do echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done
提示:以上腳本通過下面的修改也會產生類似的輸出但是還是有點不同的,在你的終端試試吧。
- root@tecmint:~# while true; do clear; echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done
14. 命令: espeak
將你的多媒體音箱的音量調到最大,然後在將這個命令複製到你的終端,來看看你聽到上帝的聲音時的反應吧。
安裝 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
在你的終端放一把火如何。把這個“aafire”敲到你的終端,不需要什麼引號看看這神奇的一幕吧。按下任意鍵中指該程序。
安裝 aafire
- root@tecmint:~# apt-get install libaa-bin
輸出
- root@tecmint:~# aafire
16. 命令: bb
首先安裝“apt-get install bb”,然後敲入“bb”看看會發生什麼吧。
- root@tecmint:~# bb
17. 命令: url
如果在你的朋友面前用命令行來改變你的 twitter status 會不會很酷呢。用你的用戶名密碼和你想要的狀態分別替換username, password 和“your status message“就可以了。
- root@tecmint:~# url -u YourUsername:YourPassword -d status="Your status message" http://twitter.com/statuses/update.xml
18. ASCIIquarium
想要在終端弄一個水族館該,怎麼辦?
- 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
最後在終端運行“asciiquarium”或者“/usr/local/bin/asciiquarium”,記得不要加引號,神奇的一幕將在你眼前展現。
- root@tecmint:~# asciiquarium
19. 命令: funny manpages
首先安裝“apt-get install funny-manpages”然後運行下面命令的man手冊。其中一些:
- 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
該到了做一些優化的時候了。
- 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(如果你知道我的意思,汗!)
還有一些其它的命令,只是這些命令並不能在所有的系統上運行,所以本文沒有涉及到。比如說dog , filter, banner
使用愉快,你可以稍後再對我說謝謝:)您的評價是我們前進的不竭動力。告訴我們你最喜歡的命令。繼續關注,不久我會有另一篇值得閱讀的文章。
via: http://www.tecmint.com/20-funny-commands-of-linux-or-linux-is-fun-in-terminal/
譯者:Linchenguang 校對:wxy
轉自:點擊打開鏈接