Linux

linux心得。。。。
作者QQ:1134831737
RHCE 學習心得
人,一定要靠自己。不管如何艱難,我都不曾放棄!!
這個筆記是我在學習 RHCE 時寫的實驗筆記。
Linux 學習主要是兩方面,一是命令。二是服務。學以致用是最主要的。對於命令, 建
議大家只學最實用的參數, LINUX 下面的每個命令有成千上萬個參數,沒有必要去都學會,
只要學會最常用的命令與參數就夠用了。
LINUX 對於大多數朋友來說,還不是很瞭解,大家所知道的關於 linux 運行最多的肯定
是在於防火牆,高端的路由與交換方面的配置。我在學習 linux 時開始學習是感覺到很艱 難 ,
原因就在於要用另外一種方法與思維去學習一種操作系統。但是當你進入到這個學習空間
後,你就會認爲你物有所值,我學習時間有一年多了,也不是每天都在用這個操作系統 ,
也就是一個星期用上幾次,特別是服務配置,學習了很長時間, linux 是網絡操作系統 , 那
麼它的長處肯定會是在網絡方面,而不是個人方面。現在只要安全理念強一點的公司肯定 會
使用 li nux. 因爲這一個合格的網絡工程師必備的知識與技能。
我是參加培訓的,之所以參加培訓是因爲我原來學習了很長一段時間都沒有進入到
linux 門裏去,都是在一些桌面上學習,而沒有進到內核與服務方面。培訓有一個最大的好
處,那就是有什麼不懂的問題可以去問老師與同學,這也是我在學習中進步最快的地方。
寫筆記與心得已成了我一個很好的習慣,原因很簡單,能經常有目地的複習一下我所 學
習的內容。心得能記當自己當時在學習時所遇到的一些問題與經驗,每當自己回過頭來看 自
己的筆記,或是從朋友那裏得知他們從筆記中學到知識時,也特別的高興。所以我一直堅 持 。
我一直不敢說自己是一個高手,我認爲一個真正的高手就是不斷的挑戰自我。就像我
在一次做網絡工程時,遇到一個集團公司的高級工程師一樣 ,那位工程師早以白髮,但是
仍然堅持看書,不斷學習。
QQ 羣裏有大家聊的開興的朋友與我的學生,有興趣的朋友可以加進去學習一些思科
方面與 linux 方面的知識 .
在我寫完很多筆記後,也認識了很多學生和朋友。能給他們在學習時指點一二也是一
種很快樂的事情。因爲我也曾經像他們一樣,在學習時遇到很多困難但是找不到幫助的人,
我只不過做了一個曾經想做的事情。
其實,份筆記在 07 年 8 月份的時候就寫好了,但是一直到 08 年 3 月我還在修改中,
原因很簡單,我想寫一分高水平,高質量的 hrce 筆記,所以一直在不斷的修改與潤色中。
金無足赤,人無完人,這份筆記中肯定有不足與錯誤之外,希望有心的朋友指出。在寫這 份筆記的時候,得到了我的學生的大力幫助,在這裏一併幫示感謝。在這裏說明一下適合 0
基礎但是喜歡 rhce 的朋友學習 linux 的方法,推薦先看十遍臺灣台的 RHCE 教程有
7cd,verycd 上有的下,然後是十遍 chinaitlab 出的 rhce 課程,臺灣講命令講的相當好,
並且一步一步講的相當基礎,而 itlab 講的是實戰,講到在工作中如何使用 linux, 需要有一
定的基礎才能聽懂,如果你每個課程都能聽到十遍,那麼你對 linu 應當有相當的精通。 lin ux
如果按我說明的方法,先看視頻,最後對着我的實驗筆記去學習,自學過 rhc e 沒有什麼 問
題。
寫在最後:這個筆記是我的學習 linux 的一些實驗,肯定會有一些不完善與錯誤,希
望有心的朋友指出。
我與 linux 的故事
Great hopes make great man. 遠大的希望造就偉大的人。
Success belongs to the persevering. 勝利屬於堅忍不拔的人。
大約在 99/% 的人在裝好 RHEL 後第一件事情是打開 gnome 或是 kde 想上網隱聊天 ,
或是想看看電影,但是當你發現你在用 linu 的時候會出現下面的事實:分編率只有 800*6 00.
本來你在 xp 下面是 1024*768. 或是你是寬屏的:是 1280*800 現在也只有 1024*768. 發現
在 linux 下面的圖標特別大,很模糊。
當你想聽歌的時候,發現在 RHEL 下沒有軟件,在網上找了半天,終於找到一軟件,
是源碼的,上面寫了很多命令,你根本看不懂。在 xp 下面 只要 setup 點一下,就可以聽
歌看電影了,在 RHEL 下面你找到一個軟件是這樣了。當你想上 QQ 與朋友聊天的時候, 你
發現沒有這個軟件。當然, 8 月分小馬同志終於有了 linux 下面的 QQ 。當你想下載安裝的
時候,發現又是 rpm 的,你不過是剛裝好,你也不懂命令。想玩玩遊戲吧,找不到軟件。
最讓你難受的是分辯率太低,眼睛太難受了。當你裝好 RHEL 後發現在 xp 下面最基 本
的東東,看電影,聽歌,上 QQ ,玩遊戲,裝視頻驅動,你一樣也不會,一個軟件找了幾 天
也沒有找到,找到也裝不上去。這在 linux 下面是常見的事情了。這時候,大約有 99% 人 ,
會在一天後裝回 xp 。或許還有一部分在文字界面下面學習命令,學習服務,但是隻是認爲
RHEL 就是用在服務器上面的,一點也不像 xp 那樣:友好。你在想,如果在 RHEL 下面一 邊
聽歌一邊看電影,一邊學習命令,是多麼爽的事情了,歌也聽了,命令也學會了。服務也 搞
定了。不是 有很多 RHEL 的視頻吧,一邊在 RHEL 上面看一邊練習,多爽啊。
確實。 linux 的軟件安裝對於新手來說是一件非常痛苦的事情了,難到裝 RHEL 就只 能
學習服務與命令吧嗎,不能一邊學習一邊玩嗎。答案是可以的了,並且,當你認真看完我 寫
的下面的軟件安裝與實驗後,你會發現, RHEL 的效率非常的高,在 xp 下面要關機,有時
候會等上十幾秒,在 linux 下面一個 init 0 命令,讓你體會到什麼叫做作操作系統的真正主
人。不會讓你等 1 秒。
前一段時間,我在 RHEL 下面用 realplay 看電影,朋友過來看到了,很羨慕,說, RHE L
也能聽歌看電影啊,不錯,不過,我原來裝了很長時間也一直沒有搞好了,下載的是一個 . bin
的軟件,這個到底怎麼安裝啊。當我把這個軟件演示給他看以後,他興奮的不得了,說原 來
這麼簡單了。我也換成 linux 的。
你會發現,你愛上了 linux. 特別是當你一邊聽歌一邊看視頻然後一邊學習 iptables 防 火
牆的時候是多麼愜意的事情。沒有比邊玩邊學習更爽的事情了。在這裏想說明是對於學習 linux 的朋友,我想說,還是裝 RHEL 吧,雖然有很多朋在用
fc, 或是其它的。我主要想說的是,對於 rhce 來說,主要是服學如何配置服務, rhce 裏考
到的有 7 種常用服務,而當你裝 RHEL 的時候,可以邊學習學玩,主要是對 inux 有興趣,
當你能在 linux 下做 xp 任何想做的事情的時候,你就有學習的動力了,不然會一直停在怎
麼樣安裝 linux 等或是一些命令的事情上的。
請記住下面的事實: linux 是用的非常多的一種操作系統。曾經我學生問過:爲什麼我
接觸的客戶都是用的 windowns 。是不是 linux 太少了。我說:那是因爲你接觸的客戶檔 次
比較低。雖然是一句笑話,但是卻是事實。我是非常佩服李陽,李陽曾說過,你之所以不 能
脫口而出英語,那是因爲你說的不夠多。有一次去幫朋友搞一個防火牆,是一家外企,裏 面
有 400 多臺 pc, 網管說,有 8 成全部都是 redhat 的 linux 。所有的服務都是那個網管自己
配置的,當時我是相當佩服這位網管的,沒有話說,有的網管 400 多臺 xP 都把它搞的焦 頭
爛額,更不用說 linux 。裏面還有 hp 的 unix , SUN 的 UNIX 操作系統 solaris 10 。等等。
所以我想說的是, linux 用的真的是多得不得了,我去過數不清的機房,裏面沒有看到一臺
windown 的機器。當然了,這個網管的工資也是以萬爲單位的。兄弟,如果也想拿到這 麼
高的 memoy ,除了把 linux 學好以外,還有什麼選擇了。當然了,這只是自己的一點想 法 ,
當做參考。
RHEL5.2 下載地址
http://lib.verycd.com/2008/05/25/0000189555.html
我的是 5.1 下載地址
http://lib.verycd.com/2007/11/10/0000170314.html
安裝方法就不說了,太簡單了,全中文的沒有什麼難的,記得把 gnome 或是 kde 桌 面
安裝上去,因爲我主要是寫的在這兩個上面安裝軟件。
在這裏推薦兩本書吧。一本是專門講系統的《天下沒有難學的 Linux 》
一本是專門講服務的《 Linux 服務器配置與應用 ( 第 2 版》
讓我們來做吧。
已完工的作品
《 2009 mpls *** 自學命令配置排錯》 第一版
《 2009 3560 交換機自學命令與配置》 第一版
《 2008 *** 自學命令與配置》 第一版
《 2008 ospf 命令與配置手冊實驗筆記》第二版
《 2008 bgp 命令與配置手冊實驗筆記》第二版
《 2009 ISIS 命令與配置手冊實驗筆記》 第一版
《 2008 三層交換與路由綜合配置案例》
《 RHCE5.0 實驗手冊》
《華爲 3600 交換機實驗筆記》
《 BGP 設計與實現筆記》
《 JUNIPER NETSCREEN 防火牆基礎實驗》
《杭州某中學斷網解決辦法》
2008 年十月於杭州第一章 基礎命令
[root@CCIE /]# adduser
增加一個系統用戶 useradd 與 adduser 是一樣的命令,都是增加一個用戶。
[root@CCIE /]# useradd ccna
[root@CCIE /]# adduser ccnp
當前用戶,主機名,當前目錄。超級用戶爲 #, 一般用戶爲 $
[root@CCIE ~]#
當前賬戶路徑。 ~ 表示用戶 home 目錄 .root 的 home 爲 /root
增加一個用戶 ccne 並將其增加到 root 組中。注意 -g 是將一個用戶放到什麼組中。
[root@CCIE /]# useradd -g root ccne
[root@CCIE home]# ls -l
總計 16
drwx------ 3 ccie ccie 4096 08-20 00:01 ccie
drwx------ 3 ccna ccna 4096 08-20 16:22 ccna
drwx------ 3 ccne root 4096 08-20 16:23 ccne
drwx------ 3 ccnp ccnp 4096 08-20 16:22 ccnp
增加一個系統用戶 ccie 注意 -r
[root@CCIE /]# useradd -r ccie
增加一個系統用戶 aa 並批定目錄爲 /home/aa
[root@CCIE /]# useradd -d /home/aa aa
更改刪除用戶
[root@CCIE ~]# userdel 用戶名
記錄用戶密碼
[root@CCIE ~]# more /etc/passwd
默認密碼存放在
[root@CCIE ~]# vi /etc/shadow
組管理
[root@CCIE ~]# vi /etc/group
arpm 電源管理
筆記本沒有用電池[root@CCIE /]# apm
No APM support in kernel
指定,選項和參用空格格開
[root@CCIE /]# ls -l |less
許多選項前加 --
[root@CCIE /]# ls --help
Man 的數字 1 表示用戶指令。 5 表示文件幫助
[root@CCIE /]# man 1 passwd
[root@CCIE /]# man 5 passwd
顯示剩餘電量
[root@CCIE /]# apm -m
顯示當前系統體系結構
[root@CCIE /]# arch
i686
將程序放在後臺
[root@CCIE home]# bg
切換目錄
[root@CCIE home]# cd
[root@CCIE ~]# cd ..
[root@CCIE /]# cd .
[root@CCIE /]# cd
[root@CCIE ~]#
設置自己的 finger 消息。
[root@CCIE ~]# chfn
[root@CCIE ~]# chfn
Changing finger information for root.
Name [chfn]:
Office []:
Office Phone []:
Home Phone []:
Finger information not changed.
查看可用的 shell
[root@CCIE ~]# chsh -l
/bin/sh
/bin/bash/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh
/bin/zsh
改變當前的 shell
[root@CCIE ~]# chsh
Changing shell for root.
New shell [/bin/bash]:
通過 -s 也可以改變當前的 shell
[root@CCIE /]# chsh -s /bin/bash
Changing shell for root.
Shell changed.
[root@CCIE /]# chsh
Changing shell for root.
New shell [/bin/bash]:
創建一個文件 touch
[root@CCIE wa]# touch ccie
[root@CCIE wa]# ls
a b ccie
清除當前的屏幕
[root@CCIE ~]# clear
顯示當前的時間
[root@CCIE /]# date
2008 年 08 月 20 日 星期三 17:05:07 CST
顯示當前的文字
[root@CCIE /]# echo
[root@CCIE /]# echo hello
hello
刪除一個文件 rm
[root@CCIE wa]# rm ccie
rm: remove regular empty file `ccie'? y
[root@CCIE wa]# ls
a b
移動並重命名 mv
[root@CCIE wa]# mv ccie ccnp[root@CCIE wa]# ls
a b ccnp
考貝一個文件到另外一文件 cp
[root@CCIE ccie]# cp vi /home/ccnp
以 / 開頭是絕對路徑,沒有 / 的是相對路徑。由實際位置定。
Cd 回到 home 目錄。 Cd .. 回到根目錄。 Cd 回到上一級目錄。
[root@CCIE ~]# cd /
[root@CCIE /]# cd
[root@CCIE ~]#
執行命令後退出
[root@CCIE ~]# exec
[root@CCIE ~]# exec ls
刪除一個新的空的目錄 rmdir
[root@CCIE home]# rmdir ccnp
強制刪除一個有文件的文件夾 rm -rf
[root@CCIE home]# rm -rf ccnp
退出命令
[root@CCIE ~]# exit
顯示系統完整信息
[root@CCIE ~]# uname -a
Linux CCIE 2.6.9-5.EL #1 Wed Jan 5 19:22:18 EST 2005 i686 i686 i386 GNU/Linux
顯示主機名
[root@CCIE ~]# hostname
CCIE
顯示主機名地位置
[root@CCIE home]# more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=CCIE
更改主機名
[root@CCIE ~]# vi /etc/sysconfig/network
列出執行過的指令
[root@CCIE ~]# fc -l
將後臺的任務拉到前臺[root@CCIE /]# fg
-bash: fg: current: no such jo
查看虛擬終端的數目
[root@CCIE /]# fgconsole
1
[root@CCIE /]#
Linux 中所有的設備都文件
[root@CCIE dev]# ls -l |less
brw-rw---- 塊文件 可以隨時讀寫,硬盤光盤。 B 表示
crw-rw---- 字符文件 比如串口 c 表示。
查看登錄用戶的消息
[root@CCIE /]# finger -l
Login: root Name: chfn
Directory: /root Shell: /bin/bash
On since Wed Aug 20 16:04 (CST) on tty1 1 hour 5 minutes idle
On since Wed Aug 20 17:08 (CST) on pts/0 from 192.168.1.101
No mail.
No Plan.
顯示指定的用戶信息
[root@CCIE /]# finger -m ccie
Login: ccie Name: (null)
Directory: /home/ccie Shell: /bin/bash
Never logged in.
No mail.
No Plan
顯示內存的消息
[root@CCIE /]# free
total used free shared buffers cached
Mem: 255596 251476 4120 0 47612 153872
-/+ buffers/cache: 49992 205604
Swap: 522104 0 522104
以總和的消息顯示內存消息
[root@CCIE /]# free -t
total used free shared buffers cached
Mem: 255596 250064 5532 0 35784 160576
-/+ buffers/cache: 53704 201892
Swap: 522104 0 522104Total: 777700 250064 527636
每 4 秒 顯示一次
[root@CCIE /]# free -s 4
total used free shared buffers cached
Mem: 255596 252008 3588 0 18112 173896
-/+ buffers/cache: 60000 195596
Swap: 522104 0 522104
顯示信號
[root@CCIE /]# fuser -l
HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM
STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO
PWR SYS
UNUSED
Vi 編輯器
Vi 是一個可視化編輯器,也就是說你所做的改動能直接的看到結果。 Vi 有兩種模式,命 令
模式可以刪除,查找等 編輯模式主要是用來編輯文件。用 esc 退回來命令模式
打開一個文件 vi 文件名
[root@CCIE ccie]# ls
a a.tar inittab
[root@CCIE ccie]# vi a
命令參數
保存文件 : w
沒有改動退出 :q
有改動退出 : wq 保存改動退出 : q! 不保存改動退出。
: e 文件名, 打開別的文件工始編輯。
編輯 命令參數
i 在當前位子進入到編輯模式
I 光標到行首進到入編輯模式
a 光標退後一格進到編輯模式
A 光示退到行尾進到編輯模式
O 《小 > 在光標所在行新一行進到編輯模式
O< 大 > 在光標所在行新起上一行進到編輯模式
S 刪除光標所在字進到編輯模式
S 刪除光標所在行進到編輯模式
刪除命令
X 刪除一個字
Nx 刪除 n 個字
Dd 刪除當前行
Dw 刪除到尾剪貼
Yy 光標所在行復制
Yw 光標所在詞複製
Nyw 光標所在位後 n 個詞複製
P 貼在光標位之右 小 p
P 貼在光標位之左 大 p
取消上一個動用
U 取消上一個更新
U 取消所有的更動
Ctrl + r 重新更改
E:! 放棄更新重新更改
顯示進程
[root@CCIE /]# fuser -a /root
/root: 4897c
查看 cpu 信息
[root@CCIE /]# cat /proc/cpuinfo
查看輸入輸出信
[root@CCIE /]# cat /proc/ioports
查看系統運行時間
[root@CCIE /]# cat /proc/uptime
查看系統信息
[root@CCIE /]# cat /proc/version
查看 scsi 信息
[root@CCIE /]# cat /proc/scsi
查看 ide 信息
[root@CCIE /]# cat /proc/ide
查看網絡信息
[root@CCIE /]# cat /proc/net
查看核心系統參數
[root@CCIE /]# cat /proc/sys
系統日誌存放在 /var/log
查看核心啓動日誌[root@CCIE log]# more /var/log/dmesg
查看系統報錯日誌
[root@CCIE log]# more /var/log/messages
查看郵件日誌
[root@CCIE log]# more /var/log/maillog
直接用指令查看
[root@CCIE /]# dmesg
查看 ftp 日誌 用於記錄 ftp 服務信息
[root@CCIE /]# cat /var/log/xferlog
查看安全信息日誌 記錄與系統相關的信息
[root@CCIE /]# more /var/log/secure
查看登錄日誌
[root@CCIE /]# more /var/log/wtmp
殺死與 root 相關的進程
[root@CCIE /]# fuser -k /root
/root: 4897c
查看用戶的密碼文件
[root@CCIE /]# more /etc/passwd
[root@CCIE /]# more /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinnscd:x:28:28:NSCD Daemon:/:/sbin/nologin
rpm:x:37:37::/var/lib/rpm:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
netdump:x:34:34:Network Crash Dump user:/var/crash:/bin/bash
解釋
Login name 登錄用戶名
Passwd 密碼
Uid 用戶編號
Gid 所在組編號
Full name 用戶全名
Home directory 用戶主目錄
Shell 用戶默認的 shell
創建一個 ccie 新組
[root@CCIE /]# groupadd ccie
刪除一個 ccie 組
[root@CCIE /]# groupdel ccie
重啓 需要賬戶爲 root
[root@CCIE ~]# reboot
[root@CCIE ~]# shutdown -r now
[root@CCIE ~]#init 6
關機 需要賬戶爲 root
[root@CCIE ~]# halt
[root@CCIE ~]# shutdown -h now
[root@CCIE ~]# powerofff
[root@CCIE ~]# init 0
關閉系統關關閉電源
[root@CCIE ccie]# halt -p
顯示歷史命令
[root@CCIE ccie]# history 2
624 history
625 history 2
查看文件類型。
[root@CCIE ccie]# file inittab
inittab: ASCII English text
文件類型- 一般文件
D 目錄文件
B 塊設備文件
C 字符文件
L 鏈接文件
P 人工管道
文件權限
[root@CCIE home]# ls -l
total 32
drwx------ 2 ccie ccie 4096 Sep 7 10:26 ccie
一個文件總共有 10 種權限屬性,第一個表文件類型 2-4 表示用戶權限 5-7 組權限 8-10 其
它權限。 258 字符控制讀權限 369 表示寫 4710 表示執行權限
D 表示爲目錄文件
文件權限分爲 r w x 讀 寫 執行權限。用戶權限爲 文件所有者 u 文件所屬組 g 其它 用
戶 0
改變權限 : 只有用戶本身與 root 才能修改 .
將一個文件名改成只有用戶纔有讀寫執行
chmod u=rwx 文件名
將 ccie 文件改成只有讀的權限
[root@CCIE home]# chmod u=r 文件名 ccie
[root@CCIE home]# ls -l
total 32
dr--rwxrwx 2 ccie ccie 4096 Sep 7 10:26 ccie
drwx------ 2 wa ccie 4096 Aug 31 15:57 dcj
drwx------ 5 ccie hhh 4096 Aug 19 13:26 redhat
drwx------ 2 500 500 4096 Sep 7 09:39 wa
Chmod <ugoa > =rwx 文件名
U 表示用戶本身 g 表示組成員 o 表示其它 a 表示所有的。 = 表示改後的權限 文件名是 要
改的文件的名子。
將文件 ccnp 改爲用戶與組有執行權限
[root@CCIE home]# chmod ug=x ccnp
數字表示權限
4 讀 2 寫 1 執行
7=4+2+1 表示讀寫執行
6 讀寫
5 讀執行
3 寫執行將一個文件 ccnp 給用戶組其它讀寫執行權限 ,
[root@CCIE home]# chmod 777 ccnp
[root@CCIE home]# ls -l
total 36
dr--rwxrwx 2 ccie ccie 4096 Sep 7 10:26 ccie
-rwxrwxrwx 1 root root 0 Sep 7 11:27 ccnp
各個位置上沒有權限則爲 0
[root@CCIE home]# chmod 707 ccnp
[root@CCIE home]# ls -l
total 36
dr--rwxrwx 2 ccie ccie 4096 Sep 7 10:26 ccie
-rwx---rwx 1 root root 0 Sep 7 11:27 ccnp
Chown 用來改變文件擁用者。
將 ccie 這個文件的用戶變 ccie 變成 root
[root@CCIE home]# ls -l
total 36
dr--rwxrwx 2 ccie ccie 4096 Sep 7 10:26 ccie
[root@CCIE home]# chown root ccie
[root@CCIE home]# ls -l
total 36
dr--rwxrwx 2 root ccie 4096 Sep 7 10:26 ccie
Chgrp 用來改變所屬組。
Chgrp 組名 文件名
文件所有者與 root 用戶通過命令來改變所屬組。
[root@CCIE ccie]# ls -l
total 8
-rw-r--r-- 1 root root 1666 Sep 7 09:57 inittab
[root@CCIE ccie]# chgrp ccie inittab
[root@CCIE ccie]# ls -l
total 8
-rw-r--r-- 1 root ccie 1666 Sep 7 09:57 inittab
文件名規則:一個文件名最多爲 255 個字符。以點開頭爲隱藏文件。
目錄在文件類型上用 d 表示
/ 表示根目錄。對於每個用戶都有一個當前目錄。
。文件與。。文件。
。表示當前目錄的一個硬連結。。。表示上一級目錄的硬連結。
目錄權限:
與文件有相同的權限。讀:只可以讀取目錄內內容
寫:執行。有向目錄中增加刪除權限
執行:進入到目錄,調用資料。
如果一個目錄只有 --x 權限,則無法列出目錄內容,但是可以執行等程序。
強制位冒險位
強制位:給一般用戶有文件所者相同的權限。
冒險位:一般文件中如果有 w x 則所有的用戶都有建立與刪除文件能力。但是設置冒險位
後只有文件所有,目錄所有與管理員纔可能刪除文件。
U g 0 分別對應:強制位 Set uid 強制位 set gid 和 sticky 冒險位 . 設置好以後,強制位會
在 u g 位置上用用一個 s 冒險位會採用 t 表示。強制位在用戶 u 中表示爲 4 set uid. 強制 位
在組 g 中表示爲 2 set gid 冒險位在其它 0 中表示爲 1 sticky.
[root@CCIE ccie]# chmod 1777 inittab
[root@CCIE ccie]# ls -l
total 8
-rwxrwxrwt 1 root ccie 1666 Sep 7 09:57 inittab
[root@CCIE ccie]# chmod 6777 inittab
[root@CCIE ccie]# ls -l
total 8
-rwsrwsrwx 1 root ccie 1666 Sep 7 09:57 inittab
[root@CCIE ccie]# chmod 7777 inittab
[root@CCIE ccie]# ls -l
total 8
-rwsrwsrwt 1 root ccie 1666 Sep 7 09:57 inittab
清除歷史命令
[root@CCIE ccie]# history -c
[root@CCIE ccie]# history
1 history
顯示用戶的 id 與所屬組的 id
[root@CCIE ~]# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
[root@CCIE ~]# id -g
0
[root@CCIE ~]# id -G
0 1 2 3 4 6 10[root@CCIE ~]# id root
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
查看文件 a 的信息
[root@CCIE ccie]# info a
根目錄下文件類型
/bin 常用指令
/usr/bin 常用指令
/boot 核心啓動文件
/dev 設備文件
/etc 服務與配置文件
/home 個人文件
/lib 庫文件與驅動
/usr/lib 庫文件驅動。
/lost+found 孤兒文件。
/mnt 常用掛載點
/opt 第三方工具使用目錄
/proc 系統信息
/root root 目錄
/sbin 系統管理指命令
/tmp 臨時文件
/usr 與用戶有關的目錄
/var 可能會改變的數據。
顯示進程間的通信狀態
[root@CCIE ccie]# ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
------ Semaphore Arrays --------
key semid owner perms nsems
------ Message Queues --------
key msqid owner perms used-bytes messages
[root@CCIE ccie]# ipcs -m -t
------ Shared Memory Attach/Detach/Change Times --------
shmid owner attached detached changed
列出所有的後臺進程[root@CCIE ccie]# jobs
[root@CCIE ccie]# jobs -l
[root@CCIE ccie]# jobs -p
設備文件的使用
Echo hello > /dev/tty2 在第二個 tty 上顯示 hello
Cp /dev/fd0 /dev/fd1 考第一個軟驅到第二個軟驅
Dd if=/dev/hda of=/root/mbr bs=512 count=1
備份第一個硬盤上的 mbr
Dd 一個強大的拷貝工具
If= 文件名
Of 目標文件名
Bs=xxx 指定塊大小
Count=n 指定複製塊的數量
輸入重定向
用 < 表示輸入源。如 [root@CCIE ccie]# vi < ccie 意思是 vi 這個命令是從 ccie 這個文 件
得到的
輸出重定向:將輸出的結果放到別的文件中
[root@CCIE ccie]# ls -l >a
[root@CCIE ccie]# ls
a inittab.txt
[root@CCIE ccie]# more a
total 12
-rw-r--r-- 1 root root 0 Oct 24 21:53 a
---x--x--- 1 ccie ccie 1666 Oct 24 21:30 inittab
[root@CCIE /]# ls -l >/home/ccie/a 意思:將根目錄下的顯示輸出到 /home/ccie/a
這個文件中。
殺死進程
[root@CCIE ccie]# kill 12345
殺死所有的同名進程
[root@CCIE ccie]# killall 1234
查看最後登陸的用戶
[root@CCIE ccie]# last
查看最後登陸的主機 ip 地址
[root@CCIE ccie]# last -n 5 -a -i
root pts/0 Wed Aug 20 17:08 still logged in 192.168.1.101root pts/0 Wed Aug 20 17:07 - 17:08 (00:00) 192.168.1.101
root pts/0 Wed Aug 20 17:07 - 17:07 (00:00) 192.168.1.101
root pts/0 Wed Aug 20 17:06 - 17:07 (00:00) 192.168.1.101
root pts/0 Wed Aug 20 17:06 - 17:06 (00:00) 192.168.1.101
wtmp begins Tue Aug 19 23:53:01 2008
查 看 登陸失敗的相關消息
[root@CCIE ccie]# lastb
ssh:notty 192.168.1.102 Wed Aug 20 00:00 - 00:00 (00:00)
(unknown :0 Tue Aug 19 23:59 - 23:59 (00:00)
btmp begins Tue Aug 19 23:59:09 2008
重新登陸
[root@CCIE ~]# login
顯示登陸帳號消息
[root@CCIE ~]# logname
Root
查看所有的語言支持
[root@localhost ~]# locale -a
將字體變成中文
[root@localhost /]# LANG=zh_CN.gb2312
語言環境默認情況下
[root@localhost /]# ls /etc/sysconfig/i18n
[root@localhost /]# cat /etc/sysconfig/i18n
LANG="zh_CN.UTF-8"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh"
SYSFONT="latarcyrheb-sun16"
修改地址:
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
配置網絡另外一個命令
[root@localhost ~]# netconfig ||neat
顯示 linux 的內核模塊消息
[root@CCIE /]# lsmod創建一個字體的文件目錄
[root@CCIE ccie]# mkfontdir
[root@CCIE ccie]# ls
a fonts.dir
查看所有的持載
[root@CCIE ccie]# mount -l
/dev/hda1 on / type ext3 (rw) [/]
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
將 u 盤掛載到 mnt/u
[root@CCIE ccie]# mount /dev/sda1 /mnt/u
將已存在的設備重新掛載
[root@CCIE ccie]# mount --bind /mnt/usb /mnt/usb1
配置各種服務
[root@CCIE ccie]# ntsysv
因爲第次啓動都會查新硬件將會耗費一定時間,關閉硬件檢測。
[root@CCIE ~]# chkconfig kudzu off
關閉 sendmail 服務
[root@CCIE ~]# chkconfig sendmail off
關閉防火牆防服
[root@CCIE ~]# chkconfig iptables off
殺死所有的 tty1 下的進程
[root@CCIE etc]# pkill -t tty1
殺死 http 服務
[root@CCIE ~]# killall httpd
顯示特定進程的內存消息
[root@CCIE etc]# ps -a
PID TTY TIME CMD
27849 pts/0 00:00:00 bash27862 pts/0 00:00:00 bash
27917 pts/0 00:00:00 ps
[root@CCIE etc]# pmap 27849
27849: bash
00227000 104K r-x-- /lib/ld-2.5.so
00241000 4K r-x-- /lib/ld-2.5.so
00242000 4K rwx-- /lib/ld-2.5.so
顯示系統狀態
[root@CCIE /]# ps
PID TTY TIME CMD
27395 pts/0 00:00:00 bash
27849 pts/0 00:00:00 bash
27862 pts/0 00:00:00 bash
27927 pts/0 00:00:00 ps
顯示指定用戶的系統進程
[root@CCIE /]# ps -u root
[root@CCIE /]# ps -t tty1
PID TTY TIME CMD
27913 tty1 00:00:00 mingetty
[root@CCIE /]# ps -efww
以樹狀圖型顯示
[root@CCIE /]# pstree
[root@CCIE /]# pstree -u
查密碼文件
[root@CCIE /]# pwck /etc/passwd
用戶 adm :目錄 /var/adm 不存在
用戶 uucp :目錄 /var/spool/uucp 不存在
用戶 gopher :目錄 /var/gopher 不存在
用戶 pcap :目錄 /var/arpwatch 不存在
用戶 sabayon :目錄 /home/sabayon 不存在
查看工作目錄
[root@CCIE /]# pwd
/
系統日誌
核心起動日誌 : 些日誌寫在系統每次啓動時,包括核心裝入時系統所有的輸出數據
[root@CCIE ~]# cat /var/log/dmesg系統報錯日誌
[root@CCIE ~]# more /var/log/messages
郵件系統日誌
[root@CCIE ~]# more /var/log/maillog
ftp 服務日誌
[root@CCIE ~]# more /var/log/xferlog
安全信息與網絡信息日誌
[root@CCIE ~]# more /var/log/secure
登錄記錄
[root@CCIE ~]# more /var/log/wtmp
將進程號爲 10 的進程改爲優先級爲 2
[root@CCIE /]# renice 2 -p 10
10: old priority -5, new priority 2
查看模塊
[root@CCIE /]# lsmod
刪除一個模塊
[root@CCIE /]# lsmod -v hid
Usage: lsmod
[root@CCIE /]#
光盤彈出
[root@localhost /]# eject
收回
[root@localhost /]# eject -t
掛載 ntfs 分區
[root@CCIE ~]# mount -t ntfs /dev/hda1 /mnt/u
結示當前 screen 作業
[root@CCIE /]# screen -ls
There is a screen on:
27989.pts-0.CCIE (Attached)
1 Socket in /var/run/screen/S-root.
系統馬上關機
[root@CCIE /]# shutdown -h now
休眠
[root@CCIE /]# sleep 1m暫停 shell
[root@CCIE /]# suspend
強制暫停 shell
[root@CCIE /]# suspend -f
顯示系統進程
[root@CCIE /]# top
[root@CCIE /]# top -c
顯示系統信息
[root@CCIE /]# uname
Linux
[root@CCIE /]# uname -a
Linux CCIE 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386
GNU/Linux
[root@CCIE /]# uname -m
i686
[root@CCIE /]# uname -n
CCIE
[root@CCIE /]# uname -r
2.6.18-92.el5
[root@CCIE /]# uname -s
Linux
[root@CCIE /]# uname -v
#1 SMP Tue Apr 29 13:16:12 EDT 2008
顯示用戶
[root@CCIE /]# users
root
顯示當前的用戶
[root@CCIE /]# w
18:36:47 up 2:36, 2 users, load average: 0.22, 0.05, 0.02
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty2 - 18:36 4.00s 0.07s 0.07s -bash
root pts/1 192.168.1.101:S. 18:25 0.00s 0.35s 0.01s w
[root@CCIE /]# w -f
18:37:14 up 2:37, 2 users, load average: 0.14, 0.04, 0.01
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
root tty2 18:36 31.00s 0.07s 0.07s -bashroot pts/1 18:25 0.00s 0.37s 0.02s w -f
[root@CCIE /]# w -s
18:37:16 up 2:37, 2 users, load average: 0.13, 0.04, 0.01
USER TTY FROM IDLE WHAT
root tty2 - 33.00s -bash
root pts/1 192.168.1.101:S. 0.00s w -s
[root@CCIE /]# w -h
root tty2 - 18:36 35.00s 0.07s 0.07s -bash
root pts/1 192.168.1.101:S. 18:25 0.00s 0.37s 0.01s w -h
將 ls -l 結果標準輸出
[root@CCIE /]# watch -d ls -l
查看命令
[root@CCIE /]# which ls
alias ls='ls --color=tty'
/bin/ls
顯示用戶消息
[root@CCIE /]# who
root tty2 2008-08-20 18:36
root pts/1 2008-08-20 18:25 (192.168.1.101:S.0)
[root@CCIE /]# who -H
NAME LINE TIME COMMENT
root tty2 2008-08-20 18:36
root pts/1 2008-08-20 18:25 (192.168.1.101:S.0)
[root@CCIE /]# who -l -H
NAME LINE TIME IDLE PID COMMENT
LOGIN tty3 2008-08-20 16:01 4835 id=3
LOGIN tty4 2008-08-20 16:01 4836 id=4
LOGIN tty5 2008-08-20 16:01 4837 id=5
LOGIN tty6 2008-08-20 16:01 4838 id=6
LOGIN tty1 2008-08-20 18:37 28110 id=1
[root@CCIE /]# whoami
root
[root@CCIE /]# whois ccie
設置命令的別名
[root@CCIE /]# alias
alias cp='cp -i'
alias l.='ls -d .* --color=tty'alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@CCIE /]# l
bash: l: command not found
[root@CCIE /]# alias a=ls
配置系統的認證消息
[root@CCIE /]# authconfig
列出系統服務的指令
[root@CCIE /]# chkconfig --list
關閉 telnet 服務
[root@CCIE /]# chkconfig telnet off
查看當前時間
[root@CCIE home]# clock
2008 年 08 月 20 日 星期三 20 時 29 分 32 秒 -0.679937 seconds
顯示開機消息
[root@CCIE home]# dmesg
顯示所有的環境變量
[root@CCIE home]# export -p
顯示當前的主機名
[root@CCIE home]# hostname
CCIE
顯示時間
[root@CCIE /]# hwclock
2008 年 08 月 21 日 星期四 14 時 19 分 42 秒 -0.817177 seconds
顯示光盤的大小
[root@CCIE /]# isosize /dev/cdrom
3076845568
修改系統等待 時 間
[root@CCIE /]# vi /etc/grub.conf
# grub.conf generated by anaconda#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/hda1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=2 注意這裏的時間是等待時間。
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
initrd /boot/initrd-2.6.18-92.el5.img
顯示沒有使用的設備
[root@CCIE etc]# losetup -f
/dev/loop0
[root@CCIE etc]#
組成 raid 陣列
[root@CCIE etc]# mkraid -f /dev/hda1 + /dev/fd0
刪除一個賬戶的密碼
[root@CCIE etc]# passwd -d ccie
Removing password for user ccie.
passwd: Success
設置用戶的開機投影密碼
[root@CCIE etc]# pwconv
關閉用戶的投影密碼
[root@CCIE etc]# pwunconv
設置終端的屏幕大小
[root@CCIE etc]# resize -s 60 120
顯示軟件的安裝信息
[root@CCIE etc]# rpm -qi rpm
Name : rpm Relocations: (not relocatable)
Version : 4.4.2 Vendor: Red Hat, Inc.
Release : 48.el5 Build Date: 2008 年 01 月 15 日 星期二22 時 25 分 00 秒
Install Date: 2008 年 08 月 19 日 星期二 23 時 24 分 36 秒 Build Host: hs20-bc1-
5.build.redhat.com
Group : System Environment/Base Source RPM: rpm-4.4.2-
48.el5.src.rpm
Size : 1633585 License: GPL
Signature : DSA/SHA1, 2008 年 02 月 09 日 星期六 05 時 55 分 52 秒 , Key ID
5326810137017186
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary : RPM 軟件包管理系統。
Description :
RPM 軟件包管理器 (RPM) 是一個功能強大的命令行
驅動的軟件包管理系統。它能夠安裝、卸裝、校驗、
查詢、及更新軟件包。每個軟件包都由一個文件歸
檔,以及關於該軟件包的信息 ( 如版本、描述等 )
組成。
查一個軟件包是否安裝
[root@CCIE /]# rpm -q rpm
rpm-4.3.3-7_nonptl
查看一個軟件包的安裝情況
[root@CCIE /]# rpm -qi rpm
列出一個 rpm 包中所含有的文件
[root@CCIE /]# rpm -ql rpm
查看文件屬於那一個 rpm 包
[root@CCIE /]# rpm -qf rpm
列出所有安裝的 rpm 軟件
[root@CCIE /]# rpm -qa 包
列出一個等待安裝的 rpm 包
[root@CCIE /]# rpm -qp rpm
查 rpm 包安裝信息
[root@CCIE /]# rpm -qpi
[root@CCIE /]# rpm -qpl rpm
查 rpm 包的安裝情況
[root@CCIE cdrom]# rpm -V rpm
[root@CCIE cdrom]# rpm -Va rpm顯示當前 系統 等級
[root@CCIE etc]# runlevel
N 3
顯示當前的環境變量
[root@CCIE etc]# set
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="2" [2]="25" [3]="1" [4]="release" [5]="i686-redhat-linux-
gnu")
BASH_VERSION='3.2.25(1)-release'
COLORS=/etc/DIR_COLORS
COLUMNS=80
DIRSTACK=()
EUID=0
GROUPS=()
G_BROKEN_FILENAMES=1
HISTFILE=/root/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/root
HOSTNAME=CCIE
HOSTTYPE=i686
IFS=$' \t\n'
INPUTRC=/etc/inputrc
LANG=zh_CN.UTF-8
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=37
LOGNAME=root
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;3
3;01:or=01;05;37;41:
mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=
01;32:*.sh=01;32:*.c
sh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=0
1;31:*.Z=01;
31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;3
5:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:'
MACHTYPE=i686-redhat-linux-gnu
MAIL=/var/spool/mail/root
MAILCHECK=60
OLDPWD=/
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:
/usr/sbin:/usr
/bin:/root/bin
PIPESTATUS=([0]="0")
PPID=4883
PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '
PWD=/etc
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-
comments:monitor
SHLVL=1
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SSH_AUTH_SOCK=/tmp/ssh-aOFPTF4883/agent.4883
SSH_CLIENT='192.168.1.100 3123 22'
SSH_CONNECTION='192.168.1.100 3123 192.168.1.103 22'
SSH_TTY=/dev/pts/0
TERM=linux
UID=0
USER=root
_=clear
consoletype=pty
設置常用程序
[root@CCIE etc]# setup
建立鏈接
硬鏈接:原文件名與連接文件名都在同一物理位置
Ln
[root@CCIE ccie]# ls -il
total 16
147348 -rw-r--r-- 1 root root 1040 Oct 24 21:56 a147347 ---x--x--- 1 ccie ccie 1666 Oct 24 21:30 inittab.txt
[root@CCIE ccie]# ln a a1
[root@CCIE ccie]# ls
a a1 inittab.Txt
軟件連接相當於快捷方式
Grep 查找關健字一行
[root@CCIE ccie]# ls -l
total 16
-rw-r--r-- 1 root root 1040 Oct 24 21:56 a
---x--x--- 1 ccie ccie 1666 Oct 24 21:30 inittab.txt
[root@CCIE ccie]# ls
a inittab.Txt
[root@CCIE ccie]# grep rc inittab.txt
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
關閉或開啓交換分區
[root@CCIE etc]# fdisk -l
Disk /dev/hda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 586 4707013+ 83 Linux
/dev/hda2 587 651 522112+ 82 Linux swap / Solaris
[root@CCIE etc]# swapoff /dev/hda2
[root@CCIE etc]# swapon /dev/hda2
將系統核心參數記錄下來
[root@CCIE home]# sysctl -a >/home/b
[root@CCIE home]# ls
aa b ccie ccne
[root@CCIE home]# more b設置時區
[root@CCIE /]# timeconfig
system-config-date - (C) 2003 Red Hat, Inc.
┌────────────┤ 時區選擇 ├─────────
────┐
│ │
│ 爲系統選擇時區。 │
│ │
│ Asia/Qyzylorda ↑ │
│ Asia/Rangoon ? │
│ Asia/Riyadh ? │
│ Asia/Saigon ? │
│ Asia/Sakhalin ? │
│ Asia/Samarkand ? │
│ Asia/Seoul ? │
│ Asia/Shanghai ↓ │
│ │
│ [*] 系統時鐘使用 UTC │
│ │
│ ┌──────┐ ┌──────┐ │
│ │ 確定 │ │ 取消 │ │
│ └──────┘ └──────┘ │
│ │
│ │
└────────────────────────────
─────────┘
設 置別名 刪除別名
[root@CCIE /]# alias aa=ls 將 aa 用來代替 ls 命令
[root@CCIE /]# aa
bin dev home lost+found misc net proc sbin srv tftpboot usr
boot etc lib media mnt opt root selinux sys tmp var
[root@CCIE /]# unalias aa 取消這個命令的代替
[root@CCIE /]# aa
-bash: aa: command not found
顯示虛擬內存情況
[root@CCIE /]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa
st0 0 0 160084 8856 52696 0 0 84 23 1010 63 1 9 88
2 0
顯示磁盤信息
[root@CCIE /]# vmstat -d
持續輸出字串 good
[root@CCIE /]# yes good
顯示頭部消息 head
[root@CCIE ccie ]# ls -l
總計 8
-rw-r--r-- 1 root ccie 1666 08-20 17:43 a
-rw-r--r-- 1 root root 2 08-20 18:03 fonts.dir
[root@CCIE ccie]# head a
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <[email protected]>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
顯示前十行的頭部消息
[root@CCIE ccie]# head -n 10 a
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <[email protected]>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default runlevel. The runlevels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
[root@CCIE ccie]#
將 a 文件一頁頁顯示
[root@CCIE ccie]# less a
將 a 文件顯示出來[root@CCIE ccie]# more a
nano 文件編輯器
[root@CCIE ccie]# ls -l
總計 8
-rw-r--r-- 1 root ccie 1666 08-20 17:43 a
-rw-r--r-- 1 root root 2 08-20 18:03 fonts.dir
[root@CCIE ccie]# nano a
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
[ Read 53 lines ]
^G Get Help ^O WriteOut ^R Read File ^Y Prev
Page ^K Cut
Text ^C Cur Pos
^X Exit ^J Justify ^W Where Is ^V Next Page
^U UnCut
Text ^T To Spell
可以看到上面的幫助命令。
ctrl +x 關閉文件
在 ftp 中,退出 ftp 程試
[root@CCIE ccie]# bye
建立 ftp 連接
[root@CCIE ccie]# ftp 192.168.1.33
開啓 vsftpd 服務先查看 vsftpd 安裝情況
[root@CCIE ccie]# rpm -q vsftpd
vsftpd-2.0.5-12.el5
[root@CCIE ccie]# service vsftpd restart關閉 vsftpd : [ 確定 ]
爲 vsftpd 啓動 vsftpd : [ 確定 ]
[root@CCIE ccie]# ftp 192.168.1.103
Connected to 192.168.1.103.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (192.168.1.103:root): ccie 注意這裏用戶名
331 Please specify the password.
Password: 密碼
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
227 Entering Passive Mode (192,168,1,103,191,93)
150 Here comes the directory listing.
-rw-r--r-- 1 0 500 1666 Aug 20 09:43 a
-rw-r--r-- 1 0 0 2 Aug 20 10:03 fonts.dir
226 Directory send OK.
可以看到沒有限制的賬號,可以到根目錄下,
ftp> cd /
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,1,103,231,84)
150 Here comes the directory listing.
drwxr-xr-x 2 0 0 4096 Aug 20 09:14 bin
drwxr-xr-x 3 0 0 4096 Aug 19 15:29 boot
drwxr-xr-x 11 0 0 3800 Aug 25 02:30 dev
drwxr-xr-x 100 0 0 12288 Aug 25 02:33 etc
drwxr-xr-x 5 0 0 4096 Aug 21 06:28 home
drwxr-xr-x 14 0 0 4096 Aug 20 09:14 lib
drwx------ 2 0 0 16384 Aug 19 15:18 lost+found
drwxr-xr-x 2 0 0 4096 Aug 25 02:30 media
drwxr-xr-x 2 0 0 0 Aug 25 02:30 misc
drwxr-xr-x 2 0 0 4096 Oct 10 2006 mnt
drwxr-xr-x 2 0 0 0 Aug 25 02:30 net
drwxr-xr-x 2 0 0 4096 Oct 10 2006 opt
dr-xr-xr-x 89 0 0 0 Aug 25 02:29 proc
drwxr-x--- 16 0 0 4096 Aug 20 08:56 root
drwxr-xr-x 2 0 0 12288 Aug 20 09:14 sbin
drwxr-xr-x 2 0 0 4096 Aug 19 15:20 selinuxdrwxr-xr-x 2 0 0 4096 Oct 10 2006 srv
drwxr-xr-x 11 0 0 0 Aug 25 02:29 sys
drwxr-xr-x 3 0 0 4096 Aug 19 15:38 tftpboot
drwxrwxrwt 7 0 0 4096 Aug 25 02:33 tmp
drwxr-xr-x 14 0 0 4096 Aug 19 15:24 usr
drwxr-xr-x 25 0 0 4096 Aug 19 15:42 var
226 Directory send OK.
get 下載文件
ftp> get a
local: a remote: a
227 Entering Passive Mode (192,168,1,103,139,45)
150 Opening BINARY mode data connection for a (1666 bytes).
226 File send OK.
put 上傳文件
斷開連線
ftp> close
221 Goodbye.
重新開啓連線
ftp> open
(to) 192.168.1.103
刪除文件
ftp> delete a
250 Delete operation successful.
顯示文件類行
[root@CCIE ccie]# file a
a: ASCII English text
查找 48 小時修改過的文件
[root@CCIE ccie]# find -atime -2
.
./a
顯示文件屬性
[root@CCIE ccie]# lsattr a
------------- a
以 8 進制顯示文件內容
[root@CCIE ccie]# od a顯示文件信息
[root@CCIE ccie]# stat a
File: “ a ”
Size: 1666 Blocks: 8 IO Block: 4096 一般文件
Device: 301h/769d Inode: 719548 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-08-25 11:07:37.000000000 +0800
Modify: 2008-08-25 10:48:15.000000000 +0800
Change: 2008-08-25 10:48:15.000000000 +0800
顯示默認的權限
[root@CCIE ccie]# umask
0022
設置文件權限
[root@CCIE ccie]# umask 111
[root@CCIE ccie]# umask
0111
顯示當前分區大小
[root@CCIE ccie]# fdisk -l
Disk /dev/hda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 586 4707013+ 83 Linux
/dev/hda2 587 651 522112+ 82 Linux swap / Solaris
用 fdisk 分區 hdb
[root@CCIE ccie]# fdisk /dev/hdb
a 標記分區
d 刪除分區
l 列出分區類型
m 幫助信息
n 新建分區
p 列出分區消息
q 退出但不保存
t 設置分區編號
v 進行分區的檢測
w 寫回硬盤查看文件系統並嘗試修復
[root@CCIE ccie]# fsck
fsck 1.39 (29-May-2006)
e2fsck 1.39 (29-May-2006)
/dev/hda1 is mounted.
WARNING!!! Running e2fsck on a mounted filesystem may cause
SEVERE filesystem damage.
Do you really want to continue (y/n)?
gzexe 壓縮可執行文件
[root@CCIE ccie]# gzexe a
a: 51.7%
[root@CCIE ccie]# ls
a a~ fonts.dir
[root@CCIE ccie]# ls -l
總計 12
-rw-r--r-- 1 root root 1201 08-25 11:24 a
-rw-r--r-- 1 root root 1666 08-25 10:48 a~
-rw-r--r-- 1 root root 2 08-20 18:03 fonts.dir
向指定機器發送 arp 請求。
[root@CCIE ccie]# arping 192.168.1.99
顯示 arp
[root@CCIE ccie]# arp
Address HWtype HWaddress Flags Mask
Iface
192.168.1.101 ether 00:03:0D:69:DE:80 C
eth0
192.168.1.99 ether 00:1D:60:18:46:54 C
eth0
192.168.1.1 ether 00:18:39:A5:10:20 C eth0
dns 查訊
[root@CCIE /]# host www.163.com
查詢具體的 dns
[root@CCIE /]# host -a www.g.cn
Trying "www.g.cn"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56330
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4
;; QUESTION SECTION:;www.g.cn. IN ANY
;; ANSWER SECTION:
www.g.cn. 583 IN CNAME cn.l.google.com.
;; AUTHORITY SECTION:
g.cn. 280140 IN NS ns3.google.com.
g.cn. 280140 IN NS ns4.google.com.
g.cn. 280140 IN NS ns2.google.com.
g.cn. 280140 IN NS ns1.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 287943 IN A 216.239.32.10
ns2.google.com. 287943 IN A 216.239.34.10
ns3.google.com. 287943 IN A 216.239.36.10
ns4.google.com. 287943 IN A 216.239.38.10
Received 191 bytes from 221.12.33.228#53 in 31 ms
查看網絡接口
[root@CCIE /]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:53:1F:EA
inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe53:1fea/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1492 Metric:1
RX packets:258 errors:0 dropped:0 overruns:0 frame:0
TX packets:279 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:24959 (24.3 KiB) TX bytes:35381 (34.5 KiB)
Interrupt:177 Base address:0x1080
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)
ip 轉發功能充許服務器將數據從一個子網轉到另一個子網。
[root@CCIE /]# more /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
## For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
通過將 net.ipv4.ip forward=1 來開啓。
telnet 默認採用 23 號端口通信
[root@CCIE /]# telnet 192.168.168.125
ssh 採用 22 號端口通信,比 telnet 更安全。
[root@CCIE ~]# ssh 192.168.168.125
[email protected]'s password:
關閉網卡
[root@CCIE /]# ifconfig eth0 down
開啓網卡
[root@CCIE /]# ifconfig eth0 up
顯示防火牆過濾表
[root@CCIE /]# iptables -t filter -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination禁止 ping 自己的地址
[root@CCIE log]# iptables -A INPUT -p icmp -j DROP
顯 示高級路由表
[root@CCIE /]# iptables -t mangle -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
顯示轉發包過濾表
[root@CCIE /]# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
關閉防火牆
[root@CCIE ~]# service iptables stop
開啓防火牆
[root@CCIE ~]# service iptables restart
設置 input 的規則 與 input 不合的會部丟棄。
[root@CCIE ~]# iptables -P INPUT DROP
設置 output 規則。與 output 不合的會部丟棄
[root@CCIE ~]# iptables -P OUTPUT DROP
設置 forward 規則,與 forward 不合的全部丟棄。[root@CCIE ~]# iptables -P FORWARD DROP
顯示防火牆的設置
[root@CCIE ~]# iptables-save
# Generated by iptables-save v1.3.5 on Thu Aug 28 11:44:59 2008
*filter
:INPUT ACCEPT [143:10453]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [145:14684]
-A INPUT -s 192.168.1.100 -j ACCEPT
COMMIT
# Completed on Thu Aug 28 11:44:59 2008
查看防火牆幫助
[root@CCIE log]# iptables --help |more
清空防火牆
[root@CCIE log]# iptables -F
Iptables -a 加一個規則
-d 刪除一個
-i 插入
-r 替換
-f 清空
查看編號
設置一條新規則,接受來自一個地址的一切包。
[root@CCIE ~]# iptables -A INPUT -s 192.168.1.100 -j ACCEPT
設置一條新規則,丟棄來自一個地址的一切包。
[root@CCIE /]# iptables -A INPUT -s 192.168.1.100 -j DROP
顯示 mangle 表的設置
[root@CCIE /]# iptables -t filter
iptables v1.3.5: no command specified
Try `iptables -h' or 'iptables --help' for more information.
[root@CCIE /]# iptables-save -t mangle
# Generated by iptables-save v1.3.5 on Thu Aug 28 12:58:51 2008
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed on Thu Aug 28 12:58:51 2008查看端口號
[root@CCIE /]# more /etc/services
顯示 nat 表的設置
[root@CCIE /]# iptables-save -t nat
# Generated by iptables-save v1.3.5 on Thu Aug 28 12:59:13 2008
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Thu Aug 28 12:59:13 2008
配置無線網張設備
[root@CCIE /]# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
sit0 no wireless extensions.
控制終端的寫入
[root@CCIE /]# mesg
is y
網絡診斷工具
[root@CCIE /]# mtr
查看到 www.163.com 的網絡情況
[root@CCIE /]# mtr www.163.com
CCIE (0.0.0.0)
Thu Aug 28 13:02:16 2008
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host
Loss% Last Avg Best Wrst StDev
1. 172.16.12.126
0.0% 1.8 1.9 1.3 3.1 0.3
192.168.1.12. 172.16.12.254
0.0% 4.0 3.2 2.4 4.9 0.7
3. 172.16.1.1
0.0% 3.5 2.8 1.7 4.7 0.7
4. 221.12.26.33
0.0% 5.7 5.6 2.8 16.6 2.3
5. 221.12.2.205
0.0% 8.9 12.9 4.8 45.0 8.8
6. 221.12.1.198
0.0% 3.3 3.5 2.1 7.2 0.9
7. 221.12.2.145
7.8% 4.7 6.6 2.8 48.3 6.4
221.12.1.125
221.12.1.121
221.12.2.249
221.12.1.201
221.12.2.253
8. 219.158.9.93
0.0% 4.7 5.4 3.7 8.8 0.9
219.158.9.13
219.158.12.77
9. 219.158.4.69
0.0% 14.6 14.5 3.4 26.8 5.5
219.158.5.166
10. 202.96.12.22
0.0% 56.9 33.9 13.0 56.9 12.2
219.158.4.69
11. 202.106.193.173
0.0% 33.7 32.7 27.0 52.0 4.9
202.96.12.22
12. 61.148.143.18
0.0% 34.6 34.0 27.1 58.8 6.5
202.106.193.17313. 202.108.38.14
0.0% 49.1 37.7 27.2 54.2 8.6
61.148.143.18
14. zz-9-34-a8.bta.net.cn
0.0% 32.4 31.3 27.3 45.5 3.2
202.108.38.14
查看網絡狀態
[root@CCIE /]# netstat -a
顯示網絡統計信息
[root@CCIE /]# netstat -s
顯示監聽的接口
[root@CCIE /]# netstat -l
dns 查找
[root@CCIE /]# nslookup www.g.cn
Server: 221.12.33.228
Address: 221.12.33.228#53
Non-authoritative answer:
www.g.cn canonical name = cn.l.google.com.
Name: cn.l.google.com
Address: 203.208.35.100
Name: cn.l.google.com
Address: 203.208.35.101
ping 主機
[root@CCIE /]# ping www.g.c
建立 ppp 連接
[root@CCIE /]# pppd
從遠端主機獲取時間
[root@CCIE /]# rdate 192.168.1.100
顯示當前的路由表
[root@CCIE /]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
刪除一個網關
[root@CCIE /]# route del default gw 192.168.2.2
增加一條路由
[root@CCIE /]# route add -net 1.1.1.0 netmask 255.255.255.0 dev eth0
遠程登陸一臺主機
[root@CCIE /]# ssh 192.168.1.100
與另外一客戶交淡
[root@CCIE /]# who
root pts/0 2008-08-28 12:51 (192.168.1.100)
root pts/1 2008-08-28 12:57 (192.168.1.100)
[root@CCIE /]# talk kk tty2
遠程登錄主機
[root@CCIE /]# telnet 192.168.1.103
測試 samba 配置
[root@CCIE /]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
passdb backend = tdbsam
cups options = raw
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printerspath = /var/spool/samba
printable = Yes
browseable = No
跟蹤路由
[root@CCIE /]# tracepath ww.g.cn
1: 192.168.1.103 (192.168.1.103) 2.619ms pmtu 1492
1: 172.16.12.126 (172.16.12.126) 1.899ms
2: 172.16.12.254 (172.16.12.254) 1.995ms
3: 172.16.1.1 (172.16.1.1) asymm 4 1.991ms
4: 221.12.26.33 (221.12.26.33) 5.949ms
5: 221.12.2.205 (221.12.2.205) 9.361ms
6: 221.12.2.213 (221.12.2.213) asymm 7 5.049ms
7: 221.12.2.149 (221.12.2.149) asymm 8 4.734ms
8: 219.158.13.65 (219.158.13.65) asymm 9 24.994ms
9: 219.158.11.94 (219.158.11.94) asymm 11 23.024ms
10: 219.158.32.226 (219.158.32.226) asymm 12 28.567ms
11: 203.208.62.17 (203.208.62.17) asymm 14 25.885ms
12: 203.208.35.100 (203.208.35.100) asymm 14 18.932ms
reached
Resume: pmtu 1492 hops 12 back 14
[root@CCIE /]# traceroute www.g.cn
traceroute to www.g.cn (203.208.35.101), 30 hops max, 40 byte packets
1 172.16.12.126 (172.16.12.126) 2.088 ms 2.117 ms 3.910 ms
2 172.16.12.254 (172.16.12.254) 4.747 ms 3.249 ms 4.053 ms
3 172.16.1.1 (172.16.1.1) 2.978 ms 5.303 ms 4.158 ms
4 221.12.26.33 (221.12.26.33) 19.627 ms 17.143 ms 18.069 ms
5 221.12.2.209 (221.12.2.209) 23.741 ms 20.188 ms 23.686 ms
6 221.12.1.169 (221.12.1.169) 15.276 ms 16.759 ms 17.186 ms
7 221.12.1.201 (221.12.1.201) 18.830 ms 19.722 ms 21.721 ms
8 219.158.7.185 (219.158.7.185) 55.971 ms 56.697 ms 58.162 ms
9 219.158.22.154 (219.158.22.154) 58.840 ms 52.449 ms 52.919 ms
10 219.158.32.226 (219.158.32.226) 36.534 ms 40.734 ms 32.857 ms
11 203.208.62.15 (203.208.62.15) 25.774 ms 28.681 ms 29.240 ms
12 203.208.35.101 (203.208.35.101) 33.341 ms 35.694 ms 39.274 ms
顯示當前終端
[root@CCIE /]# tty
/dev/pts/1
顯示磁盤的使用情況
[root@CCIE /]# df
文件系統 1K- 塊 已用 可用 已用 % 掛載點/dev/hda1 4559492 2465836 1858308 58% /
tmpfs 127796 0 127796 0% /dev/shm
[root@CCIE /]# df -i
文件系統 Inode (I) 已用 (I) 可用 (I) 已用 % 掛載點
/dev/hda1 1177344 107469 1069875 10% /
tmpfs 31949 1 31948 1% /dev/shm
[root@CCIE /]# df -t ext3
文件系統 1K- 塊 已用 可用 已用 % 掛載點
/dev/hda1 4559492 2465836 1858308 58% /
關閉硬盤的配額限制
[root@CCIE /]# quotaoff -a
開啓硬盤的配額限制
[root@CCIE /]# quotaon -a
顯示硬盤的空間限制
[root@CCIE /]# quotastats
Kernel quota version: 6.5.1
Number of dquot lookups: 0
Number of dquot drops: 0
Number of dquot reads: 0
Number of dquot writes: 0
Number of quotafile syncs: 22
Number of dquot cache hits: 0
Number of allocated dquots: 0
Number of free dquots: 0
Number of in use dquot entries (user/group): 0
關閉硬盤的軟件 raid
[root@CCIE /]# rpiastop -a
顯示硬盤的使用情況
[root@CCIE /]# repquota -a
顯示分區消息
[root@CCIE /]# sfdisk -l
Disk /dev/hda: 10402 cylinders, 16 heads, 63 sectors/track
Warning: The partition table looks like it was made
for C/H/S=*/255/63 (instead of 10402/16/63).
For this listing I'll assume that geometry.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0Device Boot Start End #cyls #blocks Id System
/dev/hda1 * 0+ 585 586- 4707013+ 83 Linux
/dev/hda2 586 650 65 522112+ 82 Linux swap / Solaris
/dev/hda3 0 - 0 0 0 Empty
/dev/hda4 0 - 0 0 0 Empty
將內存數據寫處硬盤
[root@CCIE /]# sync
創建一張啓用盤
[root@CCIE /]# mkbootdisk 2.6.18-92.el5
Insert a disk in /dev/fd0. Any information on the disk will be lost.
Press <Enter> to continue or ^C to abort:
mkisofs 創建一個 iso 文件
[root@CCIE ccie]# mkisofs -o aiso b
INFO: UTF-8 character encoding detected by locale settings.
Assuming UTF-8 encoded filenames on source filesystem,
use -input-charset to override.
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 0
175 extents written (0 MB)
[root@CCIE ccie]# ls
aiso b fonts.dir
指定一個分區爲交換分區
[root@CCIE ccie]# mkswap -c -vl -L swapnew/dev/hda3
啓動圖型界面
[root@CCIE ccie]# startx
顯示當前設置
[root@CCIE ccie]# xset
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章