1. 程式人生 > >【Linux】更新yum源及Linux有趣的命令

【Linux】更新yum源及Linux有趣的命令

前言

如筆者在運用yum安裝時出現如下情況:

[[email protected] /]
$sudo yum install sl
[sudo] password for Hunter: 

Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=updates error was
12
: Timeout on http://mirrorlist.centos.org/?release=6&arch=i386&repo=updates: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds') * base: mirrors.zju.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.njupt.edu.cn base | 3.7
kB 00:00 extras | 3.3 kB 00:00 updates | 3.4 kB 00:00 Setting up Install Process No package sl available. Error: Nothing to do

yum -y update 如果可以解決就好,否則可以通過如下配置方案:

【root使用者下執行】

更改方法

1、進入yum配置檔案目錄

cd /etc/yum.repos.d/
2、備份配置檔案

mv CentOS-Base.repo CentOS-Base.repo.bak
3、下載163的配置

mv CentOS6-Base-163.repo CentOS-Base.repo
5、更新資料庫

yum update

【或者可以這樣】:

直接搜尋新的yum源直接替換CentOS-Base-repo中的檔案內容
然後
yum makecache

相信學習Linux的人,整天對著一行一行的命令,沒有圖形介面,久了肯定會很無聊。下面介紹幾個有趣的命令,無聊的時候可以玩玩(裝逼可用,哈哈)

可能有的朋友系統裡沒有下列安裝命令,並且一直安裝失敗,此處介紹一篇教程:

【有趣命令集】:

  • cmatrix(像黑客帝國裡面的程式碼雨)
wget http://www.asty.org/cmatrix/dist/cmatrix-1.2a.tar.gz
tar xvf cmatrix-1.2a.tar.gz
cd cmatrix-1.2a
yum install ncurses-devel
./configure && make && make install

使用方法:[]裡是附帶的選項

cmatrix [-abBflohnsVx] [-C color]

例如 cmatrix –b效果如下:
這裡寫圖片描述
cmatrix -b -C red 把顏色變成紅色,效果如下:
這裡寫圖片描述
選項

-a :非同步滾動(預設)
-b :隨機粗體
-B :全部粗體
-f :force the linux $TERM type to be on
   求大神解釋
-l :Linux mode (sets "matrix.fnt" font in console)
   求大神解釋
-o :使用舊風格滾動(不好看)
-h :獲得幫助資訊
-n :不使用粗體(預設)
-s :"Screensaver" mode,exits on first keystroke
   求大神解釋
-x :X window 模式,好像就是顯示的符號不一樣
-V :顯示版本資訊
-u :重新整理頻率,0-9,也就是滾動的快慢
-C :顯示的顏色,支援green(預設),red,blue,white,yellow,cyan,
       magenta and black
在執行的狀態下,直接按q,即可退出程式
  • sl(大家經常用到ls命令,但是sl又有多少人知道呢)

sudo yum install sl

直接輸入sl使用,終端就會出現一輛從右到左的火車,效果如下:
這裡寫圖片描述

  • aafire(終端出現一團火)

sudo apt-get install libaa-bin

執行aafire,效果如下:
這裡寫圖片描述

  • oneko(終端出現一隻小動物,隨著你的滑鼠移動奔跑)

sudo apt-get install oneko

執行oneko,效果如下:
這裡寫圖片描述
還可以增加選項:

-position 座標 :指定X和Y來調整貓相對老鼠的位置
-rv:將前景色和背景色對調
-fg 顏色 : 前景色 (比如 oneko -dog -fg red)。
-bg 顏色 : 背景色 (比如 oneko -dog -bg green)。

  • fortune(顯示一條資訊)

sudo apt-get install fortune

執行fortune,會隨機出現一條資訊或名言,效果如圖:
這裡寫圖片描述

  • figlet(將單詞用符號拼湊出來並顯示在終端)

這裡寫圖片描述

sudo apt-get install figlet

  • cowsay(讓動物說話)

sudo apt-get install cowsay

執行cowsay “linux is fun”,效果如圖:
這裡寫圖片描述

預設是一頭牛,可以通過引數讓它顯示其他的東西
先檢視有哪些東西:cowsay –l
終端會出現以下資訊:

Cow files in /usr/share/cowsay/cows:
apt beavis.zen bong bud-frogs bunny calvin cheese cock cower daemon default
dragon dragon-and-cow duck elephant elephant-in-snake eyes flaming-sheep
ghostbusters gnu head-in hellokitty kiss kitty koala kosh luke-koala
mech-and-cow meow milk moofasa moose mutilated pony pony-smaller ren sheep
skeleton snowman sodomized-sheep stegosaurus stimpy suse three-eyes turkey
turtle tux unipony unipony-smaller vader vader-koala www

可以看到上面有很多可以選,比如選個milk
執行命令cowsay -f milk “Do youwant to drink?”,效果如圖:
這裡寫圖片描述

  • asciiquarium(把終端變成一個水族館)
wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
tar -zxvf asciiquarium.tar.gz
cd asciiquarium_1.1/
cp asciiquarium /usr/local/bin
chmod 0755 /usr/local/bin/asciiquarium

執行命令asciiquarium,效果如圖:
這裡寫圖片描述

  • toilet

sudo apt-get install toilet

這是個命令來的,他會將字串以彩色的ascii字串形式輸出到終端

結語

美好的未來只能通過自己的雙手獲取,加油!