『Linux学习』基本命令篇(三)
来源:互联网 发布:日漫中的中国知乎 编辑:程序博客网 时间:2024/05/19 04:03
1.检查磁盘空间
1)df 显示文件系统中的磁盘使用和空闲区的数量 -h选项以人类容易理解的方式列出每个文件系统的使用情况 -i是i节点的使用情况
2)du 显示磁盘的使用总量 以k字节为单位显示文件系统磁盘空间的使用的总量
[root@localhost zhao]# dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda2 8064304 6720040 934608 88% //dev/sda1 256666 18751 224663 8% /bootnone 387260 0 387260 0% /dev/shm/dev/sda5 6119520 48780 5759884 1% /home2.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.cppunix2dos: 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.cppdos2unix: 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 | moreallexport offbraceexpand onemacs onerrexit offerrtrace offfunctrace offhashall onhistexpand onhistory onignoreeof offinteractive-comments onkeyword offmonitor onnoclobber 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/tty01908 crw------- 1 root root 4, 1 Nov 10 10:29 /dev/tty11909 crw------- 1 root root 4, 2 Nov 10 10:29 /dev/tty21910 crw------- 1 root root 4, 3 Nov 10 10:29 /dev/tty31911 crw------- 1 root root 4, 4 Nov 10 10:29 /dev/tty41912 crw------- 1 root root 4, 5 Nov 10 10:29 /dev/tty51913 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, <miquels@drinkel.nl.mugnet.org># 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.sysinitl0:0:wait:/etc/rc.d/rc 0l1:1:wait:/etc/rc.d/rc 1l2:2:wait:/etc/rc.d/rc 2l3:3:wait:/etc/rc.d/rc 3l4:4:wait:/etc/rc.d/rc 4l5:5:wait:/etc/rc.d/rc 5l6: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.dtotal 112drwxr-xr-x 2 root root 4096 Oct 17 12:44 init.d-rwxr-xr-x 1 root root 2352 Mar 17 2004 rcdrwxr-xr-x 2 root root 4096 Oct 17 20:44 rc0.ddrwxr-xr-x 2 root root 4096 Oct 17 20:44 rc1.ddrwxr-xr-x 2 root root 4096 Oct 17 20:44 rc2.ddrwxr-xr-x 2 root root 4096 Oct 17 20:44 rc3.ddrwxr-xr-x 2 root root 4096 Oct 17 20:44 rc4.ddrwxr-xr-x 2 root root 4096 Oct 17 20:44 rc5.ddrwxr-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.dtotal 476lrwxrwxrwx 1 root root 21 Oct 16 07:53 K01tog-pegasus -> ../init.d/tog-pegasuslrwxrwxrwx 1 root root 13 Oct 16 07:40 K01yum -> ../init.d/yumlrwxrwxrwx 1 root root 24 Oct 16 07:40 K02NetworkManager -> ../init.d/NetworkManagerlrwxrwxrwx 1 root root 17 Oct 16 08:04 K02oddjobd -> ../init.d/oddjobdlrwxrwxrwx 1 root root 14 Oct 16 08:03 K05innd -> ../init.d/inndlrwxrwxrwx 1 root root 19 Oct 16 07:39 K05saslauthd -> ../init.d/saslauthdlrwxrwxrwx 1 root root 19 Oct 16 07:41 K10dc_server -> ../init.d/dc_serverlrwxrwxrwx 1 root root 16 Oct 16 07:40 K10psacct -> ../init.d/psacctlrwxrwxrwx 1 root root 17 Oct 16 08:03 K10radiusd -> ../init.d/radiusdlrwxrwxrwx 1 root root 19 Oct 16 07:41 K12dc_client -> ../init.d/dc_clientlrwxrwxrwx 1 root root 17 Oct 16 08:02 K12FreeWnn -> ../init.d/FreeWnnlrwxrwxrwx 1 root root 17 Oct 16 08:02 K12mailman -> ../init.d/mailmanlrwxrwxrwx 1 root root 15 Oct 16 07:41 K15httpd -> ../init.d/httpd
18.守护进程:
[zhao@localhost ~]$ls -l /etc/rc.d/rc5.dtotal 476lrwxrwxrwx 1 root root 21 Oct 16 07:53 K01tog-pegasus -> ../init.d/tog-pegasuslrwxrwxrwx 1 root root 13 Oct 16 07:40 K01yum -> ../init.d/yumlrwxrwxrwx 1 root root 24 Oct 16 07:40 K02NetworkManager -> ../init.d/NetworkManagerlrwxrwxrwx 1 root root 17 Oct 16 08:04 K02oddjobd -> ../init.d/oddjobdlrwxrwxrwx 1 root root 14 Oct 16 08:03 K05innd -> ../init.d/inndlrwxrwxrwx 1 root root 19 Oct 16 07:39 K05saslauthd -> ../init.d/saslauthdlrwxrwxrwx 1 root root 19 Oct 16 07:41 K10dc_server -> ../init.d/dc_serverlrwxrwxrwx 1 root root 16 Oct 16 07:40 K10psacct -> ../init.d/psacctlrwxrwxrwx 1 root root 17 Oct 16 08:03 K10radiusd -> ../init.d/radiusdlrwxrwxrwx 1 root root 19 Oct 16 07:41 K12dc_client -> ../init.d/dc_clientlrwxrwxrwx 1 root root 17 Oct 16 08:02 K12FreeWnn -> ../init.d/FreeWnnlrwxrwxrwx 1 root root 17 Oct 16 08:02 K12mailman -> ../init.d/mailmanlrwxrwxrwx 1 root root 15 Oct 16 07:41 K15httpd -> ../init.d/httpdlrwxrwxrwx 1 root root 15 Oct 16 08:03 K16rarpd -> ../init.d/rarpdlrwxrwxrwx 1 root root 20 Oct 16 08:02 K20bootparamd -> ../init.d/bootparamdlrwxrwxrwx 1 root root 24 Oct 16 08:03 K20netdump-server -> ../init.d/netdump-serverlrwxrwxrwx 1 root root 13 Oct 16 07:40 K20nfs -> ../init.d/nfslrwxrwxrwx 1 root root 16 Oct 16 08:02 K20rstatd -> ../init.d/rstatdlrwxrwxrwx 1 root root 17 Oct 16 08:02 K20rusersd -> ../init.d/rusersdlrwxrwxrwx 1 root root 15 Oct 16 08:02 K20rwhod -> ../init.d/rwhodlrwxrwxrwx 1 root root 14 Oct 16 07:40 K24irda -> ../init.d/irdalrwxrwxrwx 1 root root 15 Oct 16 07:41 K25squid -> ../init.d/squidlrwxrwxrwx 1 root root 13 Oct 16 08:04 K28amd -> ../init.d/amdlrwxrwxrwx 1 root root 22 Oct 16 07:45 K30spamassassin -> ../init.d/spamassassinlrwxrwxrwx 1 root root 18 Oct 16 08:03 K34dhcrelay -> ../init.d/dhcrelaylrwxrwxrwx 1 root root 19 Oct 16 08:03 K34yppasswdd -> ../init.d/yppasswddlrwxrwxrwx 1 root root 21 Oct 16 08:02 K35cyrus-imapd -> ../init.d/cyrus-imapdlrwxrwxrwx 1 root root 15 Oct 16 08:03 K35dhcpd -> ../init.d/dhcpdlrwxrwxrwx 1 root root 17 Oct 16 08:02 K35dovecot -> ../init.d/dovecotlrwxrwxrwx 1 root root 13 Oct 16 07:41 K35smb -> ../init.d/smblrwxrwxrwx 1 root root 19 Oct 16 07:42 K35vncserver -> ../init.d/vncserverlrwxrwxrwx 1 root root 17 Oct 16 08:23 K35winbind -> ../init.d/winbindlrwxrwxrwx 1 root root 16 Oct 16 08:03 K36dhcp6s -> ../init.d/dhcp6slrwxrwxrwx 1 root root 14 Oct 16 07:59 K36lisa -> ../init.d/lisalrwxrwxrwx 1 root root 16 Oct 16 08:03 K36mysqld -> ../init.d/mysqldlrwxrwxrwx 1 root root 20 Oct 16 08:03 K36postgresql -> ../init.d/postgresqllrwxrwxrwx 1 root root 18 Oct 16 08:20 K45arpwatch -> ../init.d/arpwatchlrwxrwxrwx 1 root root 15 Oct 16 08:03 K46radvd -> ../init.d/radvdlrwxrwxrwx 1 root root 16 Oct 16 07:40 K50ibmasm -> ../init.d/ibmasmlrwxrwxrwx 1 root root 17 Oct 16 07:40 K50netdump -> ../init.d/netdumplrwxrwxrwx 1 root root 15 Oct 16 07:41 K50snmpd -> ../init.d/snmpdlrwxrwxrwx 1 root root 19 Oct 16 07:41 K50snmptrapd -> ../init.d/snmptrapdlrwxrwxrwx 1 root root 13 Oct 16 07:41 K50tux -> ../init.d/tuxlrwxrwxrwx 1 root root 16 Oct 16 08:01 K50vsftpd -> ../init.d/vsftpdlrwxrwxrwx 1 root root 14 Oct 16 08:03 K61ldap -> ../init.d/ldaplrwxrwxrwx 1 root root 16 Oct 16 08:03 K65kadmin -> ../init.d/kadminlrwxrwxrwx 1 root root 15 Oct 16 08:03 K65kprop -> ../init.d/kproplrwxrwxrwx 1 root root 16 Oct 16 08:03 K65krb524 -> ../init.d/krb524lrwxrwxrwx 1 root root 17 Oct 16 08:03 K65krb5kdc -> ../init.d/krb5kdclrwxrwxrwx 1 root root 16 Oct 16 08:23 K73ypbind -> ../init.d/ypbindlrwxrwxrwx 1 root root 14 Oct 16 08:23 K74nscd -> ../init.d/nscdlrwxrwxrwx 1 root root 14 Oct 16 08:52 K74ntpd -> ../init.d/ntpdlrwxrwxrwx 1 root root 16 Oct 16 08:03 K74ypserv -> ../init.d/ypservlrwxrwxrwx 1 root root 16 Oct 16 08:03 K74ypxfrd -> ../init.d/ypxfrdlrwxrwxrwx 1 root root 14 Oct 16 08:02 K84bgpd -> ../init.d/bgpdlrwxrwxrwx 1 root root 16 Oct 16 08:02 K84ospf6d -> ../init.d/ospf6dlrwxrwxrwx 1 root root 15 Oct 16 08:02 K84ospfd -> ../init.d/ospfdlrwxrwxrwx 1 root root 14 Oct 16 08:02 K84ripd -> ../init.d/ripdlrwxrwxrwx 1 root root 16 Oct 16 08:02 K84ripngd -> ../init.d/ripngdlrwxrwxrwx 1 root root 15 Oct 16 07:40 K85mdmpd -> ../init.d/mdmpdlrwxrwxrwx 1 root root 15 Oct 16 08:02 K85zebra -> ../init.d/zebralrwxrwxrwx 1 root root 16 Oct 16 07:39 K87auditd -> ../init.d/auditdlrwxrwxrwx 1 root root 14 Oct 17 20:44 K87ipmi -> ../init.d/ipmilrwxrwxrwx 1 root root 20 Oct 16 08:04 K87multipathd -> ../init.d/multipathdlrwxrwxrwx 1 root root 15 Oct 16 08:01 K87named -> ../init.d/namedlrwxrwxrwx 1 root root 15 Oct 16 08:02 K89iscsi -> ../init.d/iscsilrwxrwxrwx 1 root root 18 Oct 16 07:39 K89netplugd -> ../init.d/netplugdlrwxrwxrwx 1 root root 19 Oct 16 07:40 K90bluetooth -> ../init.d/bluetoothlrwxrwxrwx 1 root root 18 Oct 16 07:40 K94diskdump -> ../init.d/diskdumplrwxrwxrwx 1 root root 23 Oct 16 07:40 S00microcode_ctl -> ../init.d/microcode_ctllrwxrwxrwx 1 root root 17 Oct 16 08:04 S01sysstat -> ../init.d/sysstatlrwxrwxrwx 1 root root 25 Oct 16 07:40 S04readahead_early -> ../init.d/readahead_earlylrwxrwxrwx 1 root root 15 Oct 16 07:39 S05kudzu -> ../init.d/kudzulrwxrwxrwx 1 root root 17 Oct 16 07:40 S05openibd -> ../init.d/openibdlrwxrwxrwx 1 root root 18 Oct 16 07:40 S06cpuspeed -> ../init.d/cpuspeedlrwxrwxrwx 1 root root 22 Oct 16 08:04 S08arptables_jf -> ../init.d/arptables_jflrwxrwxrwx 1 root root 19 Oct 16 08:02 S08ip6tables -> ../init.d/ip6tableslrwxrwxrwx 1 root root 18 Oct 16 07:40 S08iptables -> ../init.d/iptableslrwxrwxrwx 1 root root 14 Oct 16 07:40 S09isdn -> ../init.d/isdnlrwxrwxrwx 1 root root 16 Oct 16 07:40 S09pcmcia -> ../init.d/pcmcialrwxrwxrwx 1 root root 17 Oct 16 07:39 S10network -> ../init.d/networklrwxrwxrwx 1 root root 16 Oct 16 07:39 S12syslog -> ../init.d/sysloglrwxrwxrwx 1 root root 20 Oct 16 07:40 S13irqbalance -> ../init.d/irqbalancelrwxrwxrwx 1 root root 17 Oct 16 07:40 S13portmap -> ../init.d/portmaplrwxrwxrwx 1 root root 17 Oct 16 07:40 S14nfslock -> ../init.d/nfslocklrwxrwxrwx 1 root root 19 Oct 16 07:40 S15mdmonitor -> ../init.d/mdmonitorlrwxrwxrwx 1 root root 19 Oct 16 07:40 S18rpcidmapd -> ../init.d/rpcidmapdlrwxrwxrwx 1 root root 17 Oct 16 07:40 S19rpcgssd -> ../init.d/rpcgssdlrwxrwxrwx 1 root root 14 Oct 16 08:04 S24o2cb -> ../init.d/o2cblrwxrwxrwx 1 root root 15 Oct 16 07:39 S25netfs -> ../init.d/netfslrwxrwxrwx 1 root root 15 Oct 16 08:04 S25ocfs2 -> ../init.d/ocfs2lrwxrwxrwx 1 root root 14 Oct 16 07:40 S26apmd -> ../init.d/apmdlrwxrwxrwx 1 root root 20 Oct 16 07:41 S26lm_sensors -> ../init.d/lm_sensorslrwxrwxrwx 1 root root 16 Oct 16 07:40 S28autofs -> ../init.d/autofslrwxrwxrwx 1 root root 19 Oct 16 08:04 S29oracleasm -> ../init.d/oracleasmlrwxrwxrwx 1 root root 17 Oct 17 12:43 S30vboxadd -> ../init.d/vboxaddlrwxrwxrwx 1 root root 21 Oct 17 20:44 S30vboxadd-x11 -> ../init.d/vboxadd-x11lrwxrwxrwx 1 root root 25 Oct 17 12:44 S35vboxadd-service -> ../init.d/vboxadd-servicelrwxrwxrwx 1 root root 16 Oct 16 07:40 S40smartd -> ../init.d/smartdlrwxrwxrwx 1 root root 15 Oct 16 07:40 S44acpid -> ../init.d/acpidlrwxrwxrwx 1 root root 14 Oct 16 07:41 S54hpoj -> ../init.d/hpojlrwxrwxrwx 1 root root 14 Oct 16 07:40 S55cups -> ../init.d/cupslrwxrwxrwx 1 root root 14 Oct 16 07:40 S55sshd -> ../init.d/sshdlrwxrwxrwx 1 root root 20 Oct 16 07:39 S56rawdevices -> ../init.d/rawdeviceslrwxrwxrwx 1 root root 16 Oct 16 07:40 S56xinetd -> ../init.d/xinetdlrwxrwxrwx 1 root root 18 Oct 16 07:40 S80sendmail -> ../init.d/sendmaillrwxrwxrwx 1 root root 13 Oct 16 07:40 S85gpm -> ../init.d/gpmlrwxrwxrwx 1 root root 14 Oct 16 08:00 S87iiim -> ../init.d/iiimlrwxrwxrwx 1 root root 15 Oct 16 08:01 S90canna -> ../init.d/cannalrwxrwxrwx 1 root root 15 Oct 16 07:40 S90crond -> ../init.d/crondlrwxrwxrwx 1 root root 13 Oct 16 07:41 S90xfs -> ../init.d/xfslrwxrwxrwx 1 root root 17 Oct 16 07:40 S95anacron -> ../init.d/anacronlrwxrwxrwx 1 root root 13 Oct 16 07:40 S95atd -> ../init.d/atdlrwxrwxrwx 1 root root 19 Oct 16 07:40 S96readahead -> ../init.d/readaheadlrwxrwxrwx 1 root root 20 Oct 16 07:39 S97messagebus -> ../init.d/messagebuslrwxrwxrwx 1 root root 15 Oct 16 07:40 S97rhnsd -> ../init.d/rhnsdlrwxrwxrwx 1 root root 28 Oct 16 07:41 S98cups-config-daemon -> ../init.d/cups-config-daemonlrwxrwxrwx 1 root root 19 Oct 16 07:39 S98haldaemon -> ../init.d/haldaemonlrwxrwxrwx 1 root root 11 Oct 16 07:39 S99local -> ../rc.local
解释一下这个列表,这里面全都是连接,这写连接名称里主要分3部分:
[root@localhost ~]# /etc/init.d/vsftpd statusvsftpd is stopped[root@localhost ~]# /etc/init.d/vsftpd startStarting vsftpd for vsftpd: [ OK ][root@localhost ~]# /etc/init.d/vsftpd statusvsftpd (pid 5475) is running...
看上面的最长的最后一个是/rc.local ,99表示最后执行,可以修改rc.local,将run level 2-5都要执行的指令或程序设定在这个文件中。
[root@localhost ~]# chkconfig --listnfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:offpostgresql 0:off 1:off 2:off 3:off 4:off 5:off 6:offnetdump 0:off 1:off 2:off 3:off 4:off 5:off 6:offvboxadd-x11 0:off 1:off 2:off 3:on 4:off 5:on 6:offypbind 0:off 1:off 2:off 3:off 4:off 5:off 6:offcpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:offhaldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:offnfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
2)chkconfig --list :
- 『Linux学习』基本命令篇(三)
- linux学习(三)--基本命令
- 『Linux学习』基本命令篇(一)
- 『Linux学习』基本命令篇(二)
- 『Linux学习』基本命令篇(四)
- 『Linux学习』基本命令篇(五)
- 『Linux学习』基本命令篇(六)
- Linux基本命令(三)
- Linux学习笔记之基本命令三(Bash Shell)
- Linux 基本命令学习笔记《三》
- linux基本命令(三)
- linux基本命令(三)
- Linux基本命令三
- Linux基本命令三
- Linux学习 命令篇(1)---基本
- Linux系统常用基本命令(三)
- Window基本命令学习(三)
- linux基本命令学习
- 《windows核心编程》读书笔记——在应用程序中使用虚拟内存
- _A AB ABC …… 分行输出
- 迅雷的视频败局
- JSP小结
- jsp作业(2)--jsp指令
- 『Linux学习』基本命令篇(三)
- Fedora 17 下安装fcitx 输入法
- 正则表达式30分钟入门教程
- ABCD……组成菱形
- Classic Shell Scripting
- Python 复制文件的方法
- 关于公司的SVN服务器的一些小事
- android学习之-activity的启动模式
- C/C++中内存管理小结