1.檢查磁盤空間
1)df 顯示文件系統中的磁盤使用和空閒區的數量 -h選項以人類容易理解的方式列出每個文件系統的使用情況 -i是i節點的使用情況
2)du 顯示磁盤的使用總量 以k字節爲單位顯示文件系統磁盤空間的使用的總量
[root@localhost zhao]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 8064304 6720040 934608 88% /
/dev/sda1 256666 18751 224663 8% /boot
none 387260 0 387260 0% /dev/shm
/dev/sda5 6119520 48780 5759884 1% /home
2.mount命令,執行磁盤等的掛載
[root@localhost zhao]# mount /dev/hdc /media/cdrom
掛載光驅到 /media/cdrom 不同設備對用的 /dev/hdc(設備文件)不同
eject 卸載 eject /media/cdrom
3.以下是軟盤的內容,由於現在軟盤用的很好,簡單介紹一些命令:
1)執行簡單的格式化
[root@localhost zhao]# fdformat /dev/fd0H1440
2)高級格式化命令
- mkfs -t ext2|ext3|vfat| /dev/fd0
- mke2fs /dev/fd0
在格式化之前首先要卸載設備文件。
4.unix2dos和dos2unix命令
[root@localhost mypro]# unix2dos main.cpp
unix2dos: converting file main.cpp to DOS format ...
[root@localhost mypro]# cat -A main.cpp
#include<stdio.h>^M$
int main()^M$
{^M$
printf("haha");^M$
return 0;^M$
}^M$
[root@localhost mypro]# dos2unix main.cpp
dos2unix: converting file main.cpp to UNIX format ...
[root@localhost mypro]# cat -A main.cpp
#include<stdio.h>$
int main()$
{$
printf("haha");$
return 0;$
}$
5.diff命令來比較兩個文件的內容
1)< 表示第一個文件中的數據行
2)> 表示第二個文件中的數據行
如果文件中有空格時,要使用“ ”引起來
sdiff
1)| 左側表示第一個文件中的數據行
2)| 右側表示第二個文件中的數據行
3)< 表示第一個文件中的數據行(當第一個文件中有數據但是第二個文件中沒有時)
4)> 表示第二個文件中的數據行(當第二個文件中有數據但是第一個文件中沒有時)
aspell和look命令檢查單詞的拼法
aspell check 文件名
expend 將TAB轉成空格
[root@localhost ~]# expand test > test.space
將test中的TAB轉換成空格
使用fmt和pr命令重新格式化正文
6.tar 歸檔文件和文件技術
tar命令中,歸檔文件名要使用相對路徑
必須使用如下選項:
1)c:創建一個新的tar文件
2)t:列出tar文件中內容的目錄
3)x:從tar文件中抽取文件
4)f:指定歸檔文件或磁帶(也可能是軟盤)設備(一般都要選)
tar可選的選項:
1)v:顯示所打包的文件的詳細信息。v是verbose的第一個字母。
2)z:使用gzip壓縮算法來壓縮打包後的文件。
3)j:使用bzip2壓縮算法打包後的文件。
[root@localhost mypro]# tar cvf mytar main.cpp m
[root@localhost mypro]# tar tvf mytar
gzip命令
gzip [選項] [壓縮文件名]
1)-v:在屏幕上顯示出文件的壓縮比
2)-c:保留原來的文件,而創建一個新的壓縮文件,其中壓縮文件名.gz結尾
而解壓縮時,只要輸入gunzip空一格之後緊跟着解壓縮的文件即可。
直接使用tar命令將文件打包到軟盤上的步驟
1)必須將使用的軟盤進行低級格式化
2)不需要將磁盤格式化成文件系統
3)必須將軟盤卸載
4)使用tar命令直接將文件打包到軟盤上。
5)在tar命令中要使用軟盤的設備名/dev/fd0,因爲軟盤已經被卸載掉了,所以不能使用軟盤所對應的目錄。
使用tar命令的M選項表示要分片打包備份
[root@localhost mypro]# tar cvfM /dev/fd0 arch
7.grep,egrep,fgrep命令來搜索文件中滿足特定模式或字符串的內容。
- c* :將匹配0個或者多個字符c
- . (點):將匹配任何一個字符而且只能是一個字符
- [xyz] :將匹配方括號中的任意一個字符
- [^ x y z ] :將匹配不包括方括號中的字符的所有字符。
- ^ :鎖定行的開頭
- $ :鎖定行的結尾
元字符如 * ,+,{,|,(,),失去了原來的含義,需要進行轉義。
grep命令是用來在每一個文件中標準輸出上搜索特定的模式。
grep 選項 模式 文件名
- -c:僅列出包含模式的行數
- -i:忽略模式中字母的大小寫
- -l:列出帶有匹配行文件的文件名
- -n:在每行的最前面列出行號
- -v:列出沒有匹配模式的行
- -w:把表達式作爲一個完整的單字來搜尋,忽略那些部分匹配的行。
如果是搜尋多個文件,grep命令只顯示在文本中發現匹配模式的文件名,而搜索的是單一的文件,grep命令的結果將顯示每一個包含匹配模式的行。
egrep命令是用來在一個或多個文件的內容中利用擴展正則表達式的元字符搜索特定的模式。
- +:匹配一個或多個前導字符
- a|b:匹配a或b
- (RE):匹配括號中的正則表達式RE
expand -t 1 emp 把emp中的TAB轉換成一個空格 -t 1的含義
使用fgrep,搜索速度快,但是不支持搜索任何正則表達式,即將通配符當作普通字符來處理。
fgrep只能搜索確定的模式。可以使用-f指定匹配模式所在的文件。
[root@localhost mypro]# echo what i want search > condition
[root@localhost mypro]# fgrep -f condition emp
8.sed命令搜索和替換字符。(shell編程時會詳細說明)
sed [選項] 命令表達式 輸入文件
命令表達式格式 ‘s/ 舊模式/新模式/標誌’ 配置多個表達式可以用 ;分開
標誌:
1)g:全局的
2)n:前n行
3)d:刪除匹配的行
eg:
[root@localhost mypro]# sed '/^$/d;/cal/d;s/tie/fox/g' sedtest
第一個模式刪除空行
第二個是參數含有cal的行
第三個是把tie替換成fox
sed ‘1,2d’ 刪除1,2行
9.awk(shell編程時會詳細說明)
awk '{command}'
1)-F 指定分隔符
2)NF 字段數
3)$NF 最後一內容
4)NR用來跟蹤所顯示的數據的數目
5)$0,表示整個數據行
10.Bash Shell的配置與變量
1)利用局域變量來設定Bash Shell
2)通過別名和函數來設定Bash Shell
3)通過set命令來設定Bash Shell
4)通過環境變量來設定Bsah Shell中的其他命令和應用程序
shell變量是內存中一個命了名的臨時存儲區,在其中可以存放數字或者字符等信息,可以利用shell變量來設定shell或其他的程序,而且變量只存在於內存中
shell變量的特徵:
1)shell變量分爲兩種,即局部變量和全局變量
2)局部變量只能在當前的工作環境中使用
3)環境變量不但可以在當前的工作shell中使用,而且會傳給它的所有子shell
4)使用set命令顯示的所有變量,其中包括局部變量和環境變量
5)使用evn命令顯示的環境變量
創建shell局部變量的方法是:變量名=變量的值
[zhao@localhost ~]$ YYYY=LLLLLL
局部變量PS1:PS1變量主要是用來設置Bash shell提示符顯示的信息的,也就是常常看到的$符號和它之前的信息
可以將一些換碼序列插入到PS1變量中:
- \d:系統當前的日期
- \t:系統當前的時間
- \h:簡短的主機名
- \u:當前用戶名
- \w:當前的工作目錄
- \!:當前命令的歷史編號:
- \$:當前普通用戶顯示$,而root用戶顯示#
- \l:顯示終端的基本名
[zhao@localhost ~]$ echo $PS1
[\u@\h \W]\$
[zhao@localhost ~]$ PS1='[\u@\h \w TTY\l \d \t \!]\$'
[zhao@localhost ~ TTY1 Sat Nov 10 10:49:26 90]$
別名:alias 別名的名字=命令字符串
1)在等號的兩邊都不能有任何空格
2)如果命令字符串中包含任何選項,元字符,命令必須使用單引號括起來
3)在一個別名中的每一個命令必須用分號(;)隔開
取消別名和取消局部變量:
unalias 別名的名字
unset 變量的名字
[zhao@localhost ~]$set -o | more
allexport off
braceexpand on
emacs on
errexit off
errtrace off
functrace off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off
這個地方說明一下noclobber選項,如果將參數的noclobber的值開啓爲on,則意味着當使用>或>&操作符時,不會損壞已經存在的文件,也就是說當使用輸出重定向符號>或>&時,如果>或>&右邊的文件已經存在,系統將不會執行這一輸出重定向命令,以保證已經不存在的文件不會遭破壞。這個爲off時,對原有的文件執行覆蓋。
將局部變量轉化成環境變量:
export 變量名
由某個用戶1通過su命令切換到用戶2,用戶1使用的shell叫做主shell,用戶2使用的shell叫做子shell。
11.shell啓動腳本和登錄shell
shell啓動腳本的作用包括4點:(Linux系統啓動後立即執行的腳本)
- 通過在啓動腳本文件中設置局部變量或運行set命令來設置shell
- 通過在啓動腳本文件中建立環境變量來設置其他程序
- 在啓動腳本文件中創建(啓用)別名
- 在啓動腳本文件中定義系統啓動時要執行的程序。
登錄shell和非登錄shell
登錄shell就是由用戶登錄的操作而觸發的所運行的shell
即用戶登錄後所使用的shell。使用su - 用戶名 切換
非登錄shell通過以下方式:
- 使用su 用戶名命令 ,這裏su命令沒有 -
- 使用圖形終端
- 執行腳本
- 從一個shell啓動的shell
- 塊設備
- 字符設備
- /dev/hda:IDE硬盤驅動器,其中hda中a是IDE的硬盤編號,如果有第二個IDE硬盤,將對應到/dev/hdb。如果這個硬盤被分區,那麼每一個分區都會有一個編號:/dev/hda1,/dev/hda2
- /dev/sda:SCSI硬盤驅動器,其中a是SCSI硬盤的編號。如果有第二個SCSI硬盤,將對應到文件/dev/sdb,如果這個硬盤被分區,那麼每一個分區都會有一個編號:/dev/sda1,/dev/是da2
- /dev/fd0:軟盤驅動器
- /dev/tty[0-7]:虛擬終端的窗口
- /dev/st0:SCSI磁帶機
[zhao@localhost ~]$ls -li /dev/tty[0-7]
471 crw-rw---- 1 root root 4, 0 Nov 10 10:28 /dev/tty0
1908 crw------- 1 root root 4, 1 Nov 10 10:29 /dev/tty1
1909 crw------- 1 root root 4, 2 Nov 10 10:29 /dev/tty2
1910 crw------- 1 root root 4, 3 Nov 10 10:29 /dev/tty3
1911 crw------- 1 root root 4, 4 Nov 10 10:29 /dev/tty4
1912 crw------- 1 root root 4, 5 Nov 10 10:29 /dev/tty5
1913 crw------- 1 root root 4, 6 Nov 10 10:29 /dev/tty6
593 crw-rw---- 1 root root 4, 7 Nov 10 10:28 /dev/tty7
上面的終端都是字符設備(c開頭),他們並不使用數據塊,因此也不需要大俠,在i節點中,存放大小的字段存放的是訪問設備的設備號。
[zhao@localhost ~]$more /etc/inittab
#
# 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)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:
# 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
0:halt 關機
1:single user mode 單用戶模式
2:multi-user without Network 不支持網絡的多用戶模式
3:full multi-user mode 完整的多用戶模式
4:unused 保留
5:X x window模式
6:reboot 重新啓動
[zhao@localhost ~]$ls -l /etc/rc.d
total 112
drwxr-xr-x 2 root root 4096 Oct 17 12:44 init.d
-rwxr-xr-x 1 root root 2352 Mar 17 2004 rc
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc0.d
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc1.d
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc2.d
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc3.d
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc4.d
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc5.d
drwxr-xr-x 2 root root 4096 Oct 17 20:44 rc6.d
-rwxr-xr-x 1 root root 220 Jun 24 2003 rc.local
-rwxr-xr-x 1 root root 28078 Oct 23 2006 rc.sysinit
只列小部分[zhao@localhost ~]$ls -l /etc/rc.d/rc5.d
total 476
lrwxrwxrwx 1 root root 21 Oct 16 07:53 K01tog-pegasus -> ../init.d/tog-pegasus
lrwxrwxrwx 1 root root 13 Oct 16 07:40 K01yum -> ../init.d/yum
lrwxrwxrwx 1 root root 24 Oct 16 07:40 K02NetworkManager -> ../init.d/NetworkManager
lrwxrwxrwx 1 root root 17 Oct 16 08:04 K02oddjobd -> ../init.d/oddjobd
lrwxrwxrwx 1 root root 14 Oct 16 08:03 K05innd -> ../init.d/innd
lrwxrwxrwx 1 root root 19 Oct 16 07:39 K05saslauthd -> ../init.d/saslauthd
lrwxrwxrwx 1 root root 19 Oct 16 07:41 K10dc_server -> ../init.d/dc_server
lrwxrwxrwx 1 root root 16 Oct 16 07:40 K10psacct -> ../init.d/psacct
lrwxrwxrwx 1 root root 17 Oct 16 08:03 K10radiusd -> ../init.d/radiusd
lrwxrwxrwx 1 root root 19 Oct 16 07:41 K12dc_client -> ../init.d/dc_client
lrwxrwxrwx 1 root root 17 Oct 16 08:02 K12FreeWnn -> ../init.d/FreeWnn
lrwxrwxrwx 1 root root 17 Oct 16 08:02 K12mailman -> ../init.d/mailman
lrwxrwxrwx 1 root root 15 Oct 16 07:41 K15httpd -> ../init.d/httpd
18.守護進程:
[zhao@localhost ~]$ls -l /etc/rc.d/rc5.d
total 476
lrwxrwxrwx 1 root root 21 Oct 16 07:53 K01tog-pegasus -> ../init.d/tog-pegasus
lrwxrwxrwx 1 root root 13 Oct 16 07:40 K01yum -> ../init.d/yum
lrwxrwxrwx 1 root root 24 Oct 16 07:40 K02NetworkManager -> ../init.d/NetworkManager
lrwxrwxrwx 1 root root 17 Oct 16 08:04 K02oddjobd -> ../init.d/oddjobd
lrwxrwxrwx 1 root root 14 Oct 16 08:03 K05innd -> ../init.d/innd
lrwxrwxrwx 1 root root 19 Oct 16 07:39 K05saslauthd -> ../init.d/saslauthd
lrwxrwxrwx 1 root root 19 Oct 16 07:41 K10dc_server -> ../init.d/dc_server
lrwxrwxrwx 1 root root 16 Oct 16 07:40 K10psacct -> ../init.d/psacct
lrwxrwxrwx 1 root root 17 Oct 16 08:03 K10radiusd -> ../init.d/radiusd
lrwxrwxrwx 1 root root 19 Oct 16 07:41 K12dc_client -> ../init.d/dc_client
lrwxrwxrwx 1 root root 17 Oct 16 08:02 K12FreeWnn -> ../init.d/FreeWnn
lrwxrwxrwx 1 root root 17 Oct 16 08:02 K12mailman -> ../init.d/mailman
lrwxrwxrwx 1 root root 15 Oct 16 07:41 K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root 15 Oct 16 08:03 K16rarpd -> ../init.d/rarpd
lrwxrwxrwx 1 root root 20 Oct 16 08:02 K20bootparamd -> ../init.d/bootparamd
lrwxrwxrwx 1 root root 24 Oct 16 08:03 K20netdump-server -> ../init.d/netdump-server
lrwxrwxrwx 1 root root 13 Oct 16 07:40 K20nfs -> ../init.d/nfs
lrwxrwxrwx 1 root root 16 Oct 16 08:02 K20rstatd -> ../init.d/rstatd
lrwxrwxrwx 1 root root 17 Oct 16 08:02 K20rusersd -> ../init.d/rusersd
lrwxrwxrwx 1 root root 15 Oct 16 08:02 K20rwhod -> ../init.d/rwhod
lrwxrwxrwx 1 root root 14 Oct 16 07:40 K24irda -> ../init.d/irda
lrwxrwxrwx 1 root root 15 Oct 16 07:41 K25squid -> ../init.d/squid
lrwxrwxrwx 1 root root 13 Oct 16 08:04 K28amd -> ../init.d/amd
lrwxrwxrwx 1 root root 22 Oct 16 07:45 K30spamassassin -> ../init.d/spamassassin
lrwxrwxrwx 1 root root 18 Oct 16 08:03 K34dhcrelay -> ../init.d/dhcrelay
lrwxrwxrwx 1 root root 19 Oct 16 08:03 K34yppasswdd -> ../init.d/yppasswdd
lrwxrwxrwx 1 root root 21 Oct 16 08:02 K35cyrus-imapd -> ../init.d/cyrus-imapd
lrwxrwxrwx 1 root root 15 Oct 16 08:03 K35dhcpd -> ../init.d/dhcpd
lrwxrwxrwx 1 root root 17 Oct 16 08:02 K35dovecot -> ../init.d/dovecot
lrwxrwxrwx 1 root root 13 Oct 16 07:41 K35smb -> ../init.d/smb
lrwxrwxrwx 1 root root 19 Oct 16 07:42 K35vncserver -> ../init.d/vncserver
lrwxrwxrwx 1 root root 17 Oct 16 08:23 K35winbind -> ../init.d/winbind
lrwxrwxrwx 1 root root 16 Oct 16 08:03 K36dhcp6s -> ../init.d/dhcp6s
lrwxrwxrwx 1 root root 14 Oct 16 07:59 K36lisa -> ../init.d/lisa
lrwxrwxrwx 1 root root 16 Oct 16 08:03 K36mysqld -> ../init.d/mysqld
lrwxrwxrwx 1 root root 20 Oct 16 08:03 K36postgresql -> ../init.d/postgresql
lrwxrwxrwx 1 root root 18 Oct 16 08:20 K45arpwatch -> ../init.d/arpwatch
lrwxrwxrwx 1 root root 15 Oct 16 08:03 K46radvd -> ../init.d/radvd
lrwxrwxrwx 1 root root 16 Oct 16 07:40 K50ibmasm -> ../init.d/ibmasm
lrwxrwxrwx 1 root root 17 Oct 16 07:40 K50netdump -> ../init.d/netdump
lrwxrwxrwx 1 root root 15 Oct 16 07:41 K50snmpd -> ../init.d/snmpd
lrwxrwxrwx 1 root root 19 Oct 16 07:41 K50snmptrapd -> ../init.d/snmptrapd
lrwxrwxrwx 1 root root 13 Oct 16 07:41 K50tux -> ../init.d/tux
lrwxrwxrwx 1 root root 16 Oct 16 08:01 K50vsftpd -> ../init.d/vsftpd
lrwxrwxrwx 1 root root 14 Oct 16 08:03 K61ldap -> ../init.d/ldap
lrwxrwxrwx 1 root root 16 Oct 16 08:03 K65kadmin -> ../init.d/kadmin
lrwxrwxrwx 1 root root 15 Oct 16 08:03 K65kprop -> ../init.d/kprop
lrwxrwxrwx 1 root root 16 Oct 16 08:03 K65krb524 -> ../init.d/krb524
lrwxrwxrwx 1 root root 17 Oct 16 08:03 K65krb5kdc -> ../init.d/krb5kdc
lrwxrwxrwx 1 root root 16 Oct 16 08:23 K73ypbind -> ../init.d/ypbind
lrwxrwxrwx 1 root root 14 Oct 16 08:23 K74nscd -> ../init.d/nscd
lrwxrwxrwx 1 root root 14 Oct 16 08:52 K74ntpd -> ../init.d/ntpd
lrwxrwxrwx 1 root root 16 Oct 16 08:03 K74ypserv -> ../init.d/ypserv
lrwxrwxrwx 1 root root 16 Oct 16 08:03 K74ypxfrd -> ../init.d/ypxfrd
lrwxrwxrwx 1 root root 14 Oct 16 08:02 K84bgpd -> ../init.d/bgpd
lrwxrwxrwx 1 root root 16 Oct 16 08:02 K84ospf6d -> ../init.d/ospf6d
lrwxrwxrwx 1 root root 15 Oct 16 08:02 K84ospfd -> ../init.d/ospfd
lrwxrwxrwx 1 root root 14 Oct 16 08:02 K84ripd -> ../init.d/ripd
lrwxrwxrwx 1 root root 16 Oct 16 08:02 K84ripngd -> ../init.d/ripngd
lrwxrwxrwx 1 root root 15 Oct 16 07:40 K85mdmpd -> ../init.d/mdmpd
lrwxrwxrwx 1 root root 15 Oct 16 08:02 K85zebra -> ../init.d/zebra
lrwxrwxrwx 1 root root 16 Oct 16 07:39 K87auditd -> ../init.d/auditd
lrwxrwxrwx 1 root root 14 Oct 17 20:44 K87ipmi -> ../init.d/ipmi
lrwxrwxrwx 1 root root 20 Oct 16 08:04 K87multipathd -> ../init.d/multipathd
lrwxrwxrwx 1 root root 15 Oct 16 08:01 K87named -> ../init.d/named
lrwxrwxrwx 1 root root 15 Oct 16 08:02 K89iscsi -> ../init.d/iscsi
lrwxrwxrwx 1 root root 18 Oct 16 07:39 K89netplugd -> ../init.d/netplugd
lrwxrwxrwx 1 root root 19 Oct 16 07:40 K90bluetooth -> ../init.d/bluetooth
lrwxrwxrwx 1 root root 18 Oct 16 07:40 K94diskdump -> ../init.d/diskdump
lrwxrwxrwx 1 root root 23 Oct 16 07:40 S00microcode_ctl -> ../init.d/microcode_ctl
lrwxrwxrwx 1 root root 17 Oct 16 08:04 S01sysstat -> ../init.d/sysstat
lrwxrwxrwx 1 root root 25 Oct 16 07:40 S04readahead_early -> ../init.d/readahead_early
lrwxrwxrwx 1 root root 15 Oct 16 07:39 S05kudzu -> ../init.d/kudzu
lrwxrwxrwx 1 root root 17 Oct 16 07:40 S05openibd -> ../init.d/openibd
lrwxrwxrwx 1 root root 18 Oct 16 07:40 S06cpuspeed -> ../init.d/cpuspeed
lrwxrwxrwx 1 root root 22 Oct 16 08:04 S08arptables_jf -> ../init.d/arptables_jf
lrwxrwxrwx 1 root root 19 Oct 16 08:02 S08ip6tables -> ../init.d/ip6tables
lrwxrwxrwx 1 root root 18 Oct 16 07:40 S08iptables -> ../init.d/iptables
lrwxrwxrwx 1 root root 14 Oct 16 07:40 S09isdn -> ../init.d/isdn
lrwxrwxrwx 1 root root 16 Oct 16 07:40 S09pcmcia -> ../init.d/pcmcia
lrwxrwxrwx 1 root root 17 Oct 16 07:39 S10network -> ../init.d/network
lrwxrwxrwx 1 root root 16 Oct 16 07:39 S12syslog -> ../init.d/syslog
lrwxrwxrwx 1 root root 20 Oct 16 07:40 S13irqbalance -> ../init.d/irqbalance
lrwxrwxrwx 1 root root 17 Oct 16 07:40 S13portmap -> ../init.d/portmap
lrwxrwxrwx 1 root root 17 Oct 16 07:40 S14nfslock -> ../init.d/nfslock
lrwxrwxrwx 1 root root 19 Oct 16 07:40 S15mdmonitor -> ../init.d/mdmonitor
lrwxrwxrwx 1 root root 19 Oct 16 07:40 S18rpcidmapd -> ../init.d/rpcidmapd
lrwxrwxrwx 1 root root 17 Oct 16 07:40 S19rpcgssd -> ../init.d/rpcgssd
lrwxrwxrwx 1 root root 14 Oct 16 08:04 S24o2cb -> ../init.d/o2cb
lrwxrwxrwx 1 root root 15 Oct 16 07:39 S25netfs -> ../init.d/netfs
lrwxrwxrwx 1 root root 15 Oct 16 08:04 S25ocfs2 -> ../init.d/ocfs2
lrwxrwxrwx 1 root root 14 Oct 16 07:40 S26apmd -> ../init.d/apmd
lrwxrwxrwx 1 root root 20 Oct 16 07:41 S26lm_sensors -> ../init.d/lm_sensors
lrwxrwxrwx 1 root root 16 Oct 16 07:40 S28autofs -> ../init.d/autofs
lrwxrwxrwx 1 root root 19 Oct 16 08:04 S29oracleasm -> ../init.d/oracleasm
lrwxrwxrwx 1 root root 17 Oct 17 12:43 S30vboxadd -> ../init.d/vboxadd
lrwxrwxrwx 1 root root 21 Oct 17 20:44 S30vboxadd-x11 -> ../init.d/vboxadd-x11
lrwxrwxrwx 1 root root 25 Oct 17 12:44 S35vboxadd-service -> ../init.d/vboxadd-service
lrwxrwxrwx 1 root root 16 Oct 16 07:40 S40smartd -> ../init.d/smartd
lrwxrwxrwx 1 root root 15 Oct 16 07:40 S44acpid -> ../init.d/acpid
lrwxrwxrwx 1 root root 14 Oct 16 07:41 S54hpoj -> ../init.d/hpoj
lrwxrwxrwx 1 root root 14 Oct 16 07:40 S55cups -> ../init.d/cups
lrwxrwxrwx 1 root root 14 Oct 16 07:40 S55sshd -> ../init.d/sshd
lrwxrwxrwx 1 root root 20 Oct 16 07:39 S56rawdevices -> ../init.d/rawdevices
lrwxrwxrwx 1 root root 16 Oct 16 07:40 S56xinetd -> ../init.d/xinetd
lrwxrwxrwx 1 root root 18 Oct 16 07:40 S80sendmail -> ../init.d/sendmail
lrwxrwxrwx 1 root root 13 Oct 16 07:40 S85gpm -> ../init.d/gpm
lrwxrwxrwx 1 root root 14 Oct 16 08:00 S87iiim -> ../init.d/iiim
lrwxrwxrwx 1 root root 15 Oct 16 08:01 S90canna -> ../init.d/canna
lrwxrwxrwx 1 root root 15 Oct 16 07:40 S90crond -> ../init.d/crond
lrwxrwxrwx 1 root root 13 Oct 16 07:41 S90xfs -> ../init.d/xfs
lrwxrwxrwx 1 root root 17 Oct 16 07:40 S95anacron -> ../init.d/anacron
lrwxrwxrwx 1 root root 13 Oct 16 07:40 S95atd -> ../init.d/atd
lrwxrwxrwx 1 root root 19 Oct 16 07:40 S96readahead -> ../init.d/readahead
lrwxrwxrwx 1 root root 20 Oct 16 07:39 S97messagebus -> ../init.d/messagebus
lrwxrwxrwx 1 root root 15 Oct 16 07:40 S97rhnsd -> ../init.d/rhnsd
lrwxrwxrwx 1 root root 28 Oct 16 07:41 S98cups-config-daemon -> ../init.d/cups-config-daemon
lrwxrwxrwx 1 root root 19 Oct 16 07:39 S98haldaemon -> ../init.d/haldaemon
lrwxrwxrwx 1 root root 11 Oct 16 07:39 S99local -> ../rc.local
解釋一下這個列表,這裏面全都是連接,這寫連接名稱裏主要分3部分:
[root@localhost ~]# /etc/init.d/vsftpd status
vsftpd is stopped
[root@localhost ~]# /etc/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]# /etc/init.d/vsftpd status
vsftpd (pid 5475) is running...
看上面的最長的最後一個是/rc.local ,99表示最後執行,可以修改rc.local,將run level 2-5都要執行的指令或程序設定在這個文件中。
[root@localhost ~]# chkconfig --list
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
postgresql 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netdump 0:off 1:off 2:off 3:off 4:off 5:off 6:off
vboxadd-x11 0:off 1:off 2:off 3:on 4:off 5:on 6:off
ypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
2)chkconfig --list :