20個Linux命令及Linux終端的趣事



玩Linux其樂無窮!本文分享了Linux命令及Linux終端的20個趣事,看完你就會相信Linux確實好玩了。


玩Linux其樂無窮!哈哈。不相信。記住我的話,在文章結尾時你就會相信Linux確實好玩了。

20 Linux Funny Commands

1. 命令:sl (蒸汽機車)

你可能瞭解 ‘ls’ 命令,並經常使用它來查看文件夾的內容。但是,有些時候你可能會拼寫成 ‘sl’ ,這時我們應該如何獲得一些樂趣而不是看見“command not found”呢?

安裝 sl

  1. root@tecmint:~# apt-get install sl      (In Debian like OS) 
  2. root@tecmint:~# yum -y install sl       (In Red Hat like OS) 

輸出

  1. root@tecmint:~# sl 

sl command

當你敲入的是‘LS‘而不是’ls‘時,這個命令也會運行。

2. 命令:telnet

非也!非也!!這可不像它平常那樣複雜。你可能很熟悉telnet。Telnet 是一個文本化的雙向網絡協議。這裏不需要安裝什麼東西。你需要的就是一個Linux系統和一個連通的網絡。

  1. root@tecmint:~# telnet towel.blinkenlights.nl 

telnet command

3. 命令:fortune

試試你未知的運氣,終端裏有時也有好玩的。

安裝 fortune

  1. root@tecmint:~# apt-get install fortune     (for aptitude based system) 
  2. root@tecmint:~# yum install fortune         (for yum based system) 
  3. root@tecmint:~# fortune 
  4. You're not my type.  For that matter, you're not even my species!!! 
  5. Future looks spotty.  You will spill soup in late evening. 
  6. You worry too much about your job.  Stop it.  You are not paid enough to worry. 
  7. Your love life will be... interesting. 

4. 命令:rev(翻轉)

它會把傳遞給它的的每個字符串都反過來,是不是很好玩。

  1. root@tecmint:~# rev 
  2. 123abc  
  3. cba321  
  4. xuniL eb ot nrob 
  5. born to be Linux 

5. 命令:factor

該談點兒關於Mathematics的了,這個命令輸出給定數字的所有因子。

  1. root@tecmint:~# factor 
  2. 5  
  3. 5: 5  
  4. 12  
  5. 12: 2 2 3  
  6. 1001  
  7. 1001: 7 11 13  
  8. 5442134  
  9. 5442134: 2 2721067 

6.命令:script

好的,這不是什麼命令,而是一個腳本,一個很有趣的腳本。

  1. 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  
  2. 1 x 11=1  
  3. 2 x 1=2 2 x 2=4  
  4. 3 x 1=3 3 x 2=6 3 x 3=9  
  5. 4 x 1=4 4 x 2=8 4 x 3=12    4 x 4=16     
  6. 5 x 1=5 5 x 2=10    5 x 3=15    5 x 4=20    5 x 5=25     
  7. 6 x 1=6 6 x 2=12    6 x 3=18    6 x 4=24    6 x 5=30    6 x 6=36     
  8. 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     
  9. 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     
  10. 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     
  11. 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  
  12. 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  
  13. 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

  1. root@tecmint:~# apt-get install cowsay      (for Debian based OS) 
  2. root@tecmint:~# yum install cowsay      (for Red Hat based OS) 

輸出

  1. root@tecmint:~# cowsay I Love nix  
  2.  ____________ 
  3. < I Love nix > 
  4.  ------------ 
  5.         \   ^__^ 
  6.          \  (oo)\_______ 
  7.             (__)\       )\/\ 
  8.                 ||----w | 
  9.                 ||     || 

如果用管道將‘fortune command’命令重定向到cowsay會怎樣呢?

  1. root@tecmint:~# fortune | cowsay 

  1. _________________________________________ 
  2. / Q: How many Oregonians does it take to  \ 
  3. | screw in a light bulb? A: Three. One to | 
  4. | screw in the light bulb and two to fend | 
  5. | off all those                           | 
  6. |                                         | 
  7. | Californians trying to share the        | 
  8. \ experience.                             / 
  9.  ----------------------------------------- 
  10.         \   ^__^ 
  11.          \  (oo)\_______ 
  12.             (__)\       )\/\ 
  13.                 ||----w | 
  14.                 ||     || 

提示:‘|’是管道命令符。通常它是將一個命令的輸出作爲下一個命令的輸入。在上面的例子中‘fortune’的輸出作爲‘cowsay’命令的輸出。管道命令會經常用在腳本和程序編寫中。

xcowsay是一個圖形界面程序。它與cowsay類似只是以一種圖形的方式來表達,可以說是X版本的cowsay。

  1. apt-get insatll xcowsay 
  2. yum install xcowsay 

輸出

  1. root@tecmint:~# xcowsay I Love nix 

xcowsay command

cowthink是另一個命令。運行“cowthink Linux is sooo funny ”看看它與cowsay的不同吧。

  1. apt-get insatll cowthink 
  2. yum install cowthink 

輸出

  1. root@tecmint:~# cowthink ....Linux is sooo funny 
  2.  _________________________ 
  3. ( ....Linux is sooo funny ) 
  4.  ------------------------- 
  5.         o   ^__^ 
  6.          o  (oo)\_______ 
  7.             (__)\       )\/\ 
  8.                 ||----w | 
  9.                 ||     || 

8. 命令:yes

yes 是一個非常有趣又有用的命令,尤其對於腳本編寫和系統管理員來說,它可以自動地生成預先定義的響應或者將其傳到終端。

  1. root@tecmint:~# yes I Love Linux 
  2.   
  3. I Love Linux 
  4. I Love Linux 
  5. I Love Linux 
  6. I Love Linux 
  7. I Love Linux 
  8. I Love Linux 
  9. I Love Linux 
  10. I Love Linux 
  11. I Love Linux 
  12. I Love Linux 
  13. I Love Linux 
  14. I Love Linux 

提示: (直到你按下ctrl+c才停止)

9. 命令: toilet

什麼?你在開玩笑嗎! 當然沒有,但肯定的是這個命令的名字太搞了,我也不知道這個命令的名字從何而來。

安裝toilet

  1. root@tecmint:~# apt-get install toilet  
  2. root@tecmint:~# yum install toilet 

輸出

  1. root@tecmint:~# toilet tecmint  
  2. mmmmmmm                        "             m                                
  3.    #     mmm    mmm   mmmmm  mmm    m mm   mm#mm          mmm    mmm   mmmmm  
  4.    #    #"  #  #"  "  # # #    #    #"  #    #           #"  "  #" "#  # # #  
  5.    #    #""""  #      # # #    #    #   #    #           #      #   #  # # #  
  6.    #    "#mm"  "#mm"  # # #  mm#mm  #   #    "mm    #    "#mm"  "#m#"  # # # 

這個命令甚至提供了一些顏色和字體格式。

  1. root@tecmint:~# toilet -f mono12 -F metal Tecmint.com 

toilet command

提示:Figlet 是另外一個與toilet產生的效果類似的命令。

10. 命令:cmatrix

你可能看多好萊塢的電影‘黑客帝國’並陶醉於被賦予Neo的能看到在矩陣中任何事物的能力,或者你會想到一幅類似於‘Hacker’的桌面的生動畫面。

安裝 cmatrix

  1. root@tecmint:~# apt-get install cmatrix 
  2. root@tecmint:~# yum install cmatrix 

輸出

  1. root@tecmint:~# cmatrix 

cmatrix command

11. 命令: oneko

可能你堅信Linux的鼠標指針永遠是同樣的黑色或白色一點兒也不生動,那你就錯了。“oneko”是一個會讓一個“Jerry”你的鼠標指針附着到你鼠標上的一個軟件包。

安裝 oneko

  1. root@tecmint:~# apt-get install oneko  
  2. root@tecmint:~# yum install oneko  

輸出

  1. root@tecmint:~# oneko  

oneko command

提示:關閉運行着oneko的終端時,Jerry也會隨之消失,重新啓動終端時也不會再出項。你可以將這個程序添加到啓動選項中然後繼續使用它。

12. Fork炸彈

這是一段非常欠抽的代碼。運行這個命令的後果自己負責。這個命令其實是一個fork炸彈,它會以指數級的自乘,直到所有的系統資源都被利用了或者系統掛起(想要見識這個命令的威力你可以試一次這個命令,但是後果自負,記得在運行它之前關掉並保存其它所有程序和文件)。

  1. root@tecmint:~# :(){ :|:& }:  

13. 命令:while

下面的”while“命令是一個腳本,這個腳本可以爲你提供彩色的日期和文件直到你按下中斷鍵(ctrl+c)。複製粘貼這個命令到你的終端。

  1. root@tecmint:~# while true; do echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done  

Linux while command

提示:以上腳本通過下面的修改也會產生類似的輸出但是還是有點不同的,在你的終端試試吧。

  1. root@tecmint:~# while true; do clear; echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done  

14. 命令: espeak

將你的多媒體音箱的音量調到最大,然後在將這個命令複製到你的終端,來看看你聽到上帝的聲音時的反應吧。

安裝 espeak

  1. root@tecmint:~# apt-get install espeak  
  2. root@tecmint:~# yum install espeak  

輸出

  1. root@tecmint:~# espeak "Tecmint is a very good website dedicated to Foss Community"  

15. 命令: aafire

在你的終端放一把火如何。把這個“aafire”敲到你的終端,不需要什麼引號看看這神奇的一幕吧。按下任意鍵中指該程序。

安裝 aafire

  1. root@tecmint:~# apt-get install libaa-bin  

輸出

  1. root@tecmint:~# aafire  

16. 命令: bb

首先安裝“apt-get install bb”,然後敲入“bb”看看會發生什麼吧。

  1. root@tecmint:~# bb  

bb command

17. 命令: url

如果在你的朋友面前用命令行來改變你的 twitter status 會不會很酷呢。用你的用戶名密碼和你想要的狀態分別替換username, password 和“your status message“就可以了。

  1. root@tecmint:~# url -u YourUsername:YourPassword -d status="Your status message" http://twitter.com/statuses/update.xml  

18. ASCIIquarium

想要在終端弄一個水族館該,怎麼辦?

  1. root@tecmint:~# apt-get install libcurses-perl  
  2. root@tecmint:~# cd /tmp   
  3. root@tecmint:~# wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz  
  4. root@tecmint:~# tar -zxvf Term-Animation-2.4.tar.gz  
  5. root@tecmint:~# cd Term-Animation-2.4/  
  6. root@tecmint:~# perl Makefile.PL &&  make &&   make test  
  7. root@tecmint:~# make install  

安裝 ASCIIquarium

下載並安裝ASCIIquarium。

  1. root@tecmint:~# cd /tmp  
  2. root@tecmint:~# wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz  
  3. root@tecmint:~# tar -zxvf asciiquarium.tar.gz  
  4. root@tecmint:~# cd asciiquarium_1.1/  
  5. root@tecmint:~# cp asciiquarium /usr/local/bin  
  6. root@tecmint:~# chmod 0755 /usr/local/bin/asciiquarium  

最後在終端運行“asciiquarium”或者“/usr/local/bin/asciiquarium”,記得不要加引號,神奇的一幕將在你眼前展現。

  1. root@tecmint:~# asciiquarium  

aquarium command

19. 命令: funny manpages

首先安裝“apt-get install funny-manpages”然後運行下面命令的man手冊。其中一些:

  1. baby  
  2. celibacy  
  3. condom  
  4. date  
  5. echo  
  6. flame  
  7. flog  
  8. gong  
  9. grope, egrope, fgrope   
  10. party   
  11. rescrog   
  12. rm  
  13. rtfm  
  14. tm  
  15. uubp  
  16. woman (undocumented)  
  17. xkill   
  18. xlart   
  19. sex   
  20. strfry  
  21.    
  22. root@tecmint:~# man baby  

20. Linux Tweaks

該到了做一些優化的時候了。

  1. root@tecmint:~# world  
  2. bash: world: not found  
  3. root@tecmint:~# touch girls\ boo**   
  4. touch: cannot touch `girls boo**`: Permission denied  
  5. root@tecmint:~# nice man woman  
  6. No manual entry for woman  
  7. root@tecmint:~# ^How did the sex change operation go?^   
  8. bash: :s^How did the sex change operation go?^ : substitution failed  
  9. root@tecmint:~# %blow   
  10. bash: fg: %blow: no such job  
  11. root@tecmint:~# make love   
  12. make: *** No rule to make target `love`.  Stop.  
  13. $ [ whereis my brain?  
  14. sh: 2: [: missing ]  
  15. % man: why did you get a divorce?   
  16. man:: Too many arguments.  
  17. % !:say, what is saccharine?   
  18. Bad substitute.  
  19. server@localhost:/srv$ \(-   
  20. 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

轉自:點擊打開鏈接
發佈了26 篇原創文章 · 獲贊 12 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章