blog

Linuxターミナルに関する20のLinuxコマンドと楽しい事実

Linuxで遊ぶのは楽しいこの記事では、LinuxコマンドとLinuxターミナルに関する20の興味深い事実を紹介しています。...

Jan 28, 2016 · 16 min. read
シェア

1.順序: sl

フォルダの中身を見るのによく使う「ls」コマンド。しかし、'sl'と綴ることもあるでしょう。では、'command not found'と表示されないようにするにはどうすればいいのでしょうか?

スリップの取り付け

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

輸出

root@tecmint:~# sl 

このコマンドは、'ls'の代わりに'LS'と入力しても実行されます。

2.コマンド:telnet

それにもかかわらず!いいえ!これは、通常ほど複雑ではありません。あなたはおそらく、テキストベースの双方向ネットワークプロトコルであるtelnetに精通しています。インストールするものは何もありません。必要なのはLinuxシステムと接続されたネットワークだけです。

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

3.順序:幸運

あなたの未知の運を試してみてください。

おみくじの設置

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

渡された文字列をすべて反転させます。

root@tecmint:~# rev 
123abc  
cba321  
xuniL eb ot nrob 
born to be Linux 

5.オーダー:ファクター

このコマンドは与えられた数のすべての因数を出力します。

root@tecmint:~# factor 
5  
5: 5  
12  
12: 2 2 3  
1001  
1001: 7 11 13  
5442134  
5442134: 2 2721067 

#p#

6.コマンド:スクリプト

これはコマンドではなく、スクリプトです。

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.オーダー:カウセイ

この子牛は、端末でASCIIで構成されます。

カウセイの設置

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と似ているのはグラフィカルな点だけで、cowsayのXバージョンと言えます。

apt-get insatll xcowsay 
yum install xcowsay 

輸出

root@tecmint:~# xcowsay I Love nix 

apt-get insatll cowthink 
yum install cowthink 

輸出

root@tecmint:~# cowthink ....Linux is sooo funny 
 _________________________ 
( ....Linux is sooo funny ) 
 ------------------------- 
        o   ^__^ 
         o  (oo)\_______ 
            (__)\       )\/\ 
                ||----w | 
                ||     || 

8.注文:はい

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 

ヒント

9.順序:トイレ

え?冗談でしょ? もちろんそんなことはありませんが、確かにこのコマンドの名前はどこから来たのかわからないほどめちゃくちゃです。

トイレの設置

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

ハリウッド映画「マトリックス」を見て、ネオに与えられたマトリックス内の何でも見ることができる能力に興奮したことがあるかもしれませんし、「ハッカー」に似たデスクトップを鮮明に思い浮かべたことがあるかもしれません。

cmatrixのインストール

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

輸出

root@tecmint:~# cmatrix 

#p#

11.オーダー:oneko

Linuxのマウスポインタはいつも同じ黒か白だと思い込んでいるかもしれませんが、それは間違いです。「Oneko は、マウスに「Jerry」マウスポインタを付けるためのパッケージです。

onekoのインストール

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

輸出

root@tecmint:~# oneko  

ヒント: oneko を起動したままターミナルを閉じると、Jerry も一緒に消えてしまい、ターミナルを再起動してもその項目は再び出てきません。このプログラムをスタートアップオプションに追加して使い続けることができます。

12.フォーク爆弾

これは非常に稚拙なコードです。このコマンドを実行した結果は、あなたの責任です。このコマンドは実際にはフォーク爆弾であり、すべてのシステムリソースが利用されるかシステムがハングアップするまで、指数関数的に自己増殖します。

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

13.コマンド:while

次の "while "コマンドは、breakキーを押すまで色のついた日付とファイルを表示するスクリプトです。このコマンドをコピーしてターミナルに貼り付けてください。

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  

#p#

16.オーダー: bb

まず "apt-get install bb "をインストールし、"bb "と入力して何が起こるか見てください。

root@tecmint:~# bb  

17.コマンド: url

Twitterのステータスを友達の前でコマンドラインから変更できたらクールだと思いませんか?ユーザー名、パスワード、"あなたのステータスメッセージ "をユーザー名、パスワード、あなたのステータスに置き換えるだけです。

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

18.アスキークアリウム

ターミナルに水槽を設置したいのですが、どうすればいいですか?

root@tecmint:~# apt-get install libcurses-perl  
root@tecmint:~# cd /tmp   
root@tecmint:~# wget http://..org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-...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://..com/projects/asciiquarium/..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.注文:面白いマンページ

まず、"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の微調整

最適化の時間です。

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はいつもセクシーです: who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep

すべてのシステムで動作しないコマンドが他にもあるので、この記事では取り上げません。例えば、dog、filter、banner

経由:

Read next

機密漏洩を防ぐエンド・ツー・エンドのセキュアな電子メール・システム

エンド・ツー・エンド伝送とは、各ユーザーの端末に制御装置を設置し、電子メール送信時にセキュリティ暗号化を実現し、電子メール受信者も制御装置を通じて電子メールを復号化することです。

Jan 26, 2016 · 2 min read