1、使用grep -v '^#' 来去掉注释行,其中:-v 就是取相反的 ^#
表示以#开头的行
eg. grep -v '^#' /etc/vsftpd/vsftpd.conf
(也可以使用“>”来重写配置文件)
2、有时也会连同空行一起去掉,使用管道符来完成(^$表示空行 )
eg. grep -v '^#' httpd.conf | grep -v '^$'
>> vsftpd.conf
上面用了 2次 grep 过滤命令 ,也就是把空行和注解行过滤掉,再把剩下的内容追加保存为原
来的配置文件 vsftpd.conf 这个时候就文件里的内容就没有注解行和空行了,,,,
3、备注:在更改配置文件时,建议先对配置文件做一下备份,对配置文件不熟悉的建议不要用这种方法,配置文件中的注解行还是有一定的帮助的。
cp -a httpd.conf httpd.conf.bak
4、shell储备知识:
^一行的开始 ^d以开头的 ^..1 第三个为1的字符
^字符要放在匹配的字符前面
$一行的末尾 ^$ 表示空行 ^.$匹配一行一个字符的 $字符要放在匹配的字符后面
*匹配任意个字符 包括0个字符 .表示单个字符
Rsysc服务搭建与使用
服务器端:
首先安装该服务的最新版 rsync-2.6.8.tar.gz
安装步骤:
1, tar zxvf rsync-2.6.8.tar.gz
2, cd rsync-2.6.8
3, ./configure –prefix= path
4, make ; make install
更改服务器端的配置文件
1,vi /etc/rsyncd.conf
uid = root 指定运行该服务的权限
gid = root
log file = /var/log/rsyncd.log 指定日志文件
[mag_sync] 定义同步项目名 可以定义多个同步项目
path = /usr/local/apps/www/magazine/file 指定源路径
read only = no 是否只读
auth users = mag_sync 该同步项目的认证用户名
secrets file = /etc/rsync.pas 该同步项目的密码文件
更改密码文件
vi /etc/rsync.pas
文件格式为 用户名:密码
mag_sync:magazine_rsync@zcom.com
更改密码文件的权限
chmod +600 /etc/rsync.pas
启动rsyncd服务
/usr/local/rsync-42.0/bin/rsync --daemon
rsync默认服务端口为873
加入rc.l
1.
NFS
无法挂载问题
先查看一下PC的防火墙设置:
查看:iptables -L
清空:iptables -F
mount: can’t find /mnt in /etc/fstab or
/etc/mtab
提示:
# umount /mnt
Fixing 'The following VMware kernal modules have been found on your
system that were not installed by the VMware installer.' If you are
getting the following error when trying to install the tools:
'The following VMware kernal modules have been found on your system
that were
not installed by the VMware installer. Please remove them then run
the installer again.
- vmblock
- vmmon
- vmnet
Execution aborted.'
You are getting this error probab
c header files matching your running kernel were not
found
2011年12月08日 星期四 18:42
vmware 6.5.5 for linux 版本 ,安装完成后执行时报错
'c header files matching your running kernel were not
found'
Vmware6.5 error
解决方法:
Just an FYI Ubuntu 10.10 is not a supported Host OS or Guest OS
in VMware Workstation 6.5 or any other VMware product at the
present time.
If all you need are the kernel headers, then in a Terminal:
sudo apt-get install linux-headers-$(uname -r)
However you need to have Development Tools installed too, so if
you don't:
sudo apt-get install build-essential linux-kernel-headers linux-kernel-devel
Kvm 网络桥接方案
出自Ubuntu中文
下面介绍配置KVM桥接网络的方法: //特别注意,大部分不能桥接无线网卡。。。只能桥接PCI网卡。。。。
安装桥接工具:
代码:
sudo apt-get install bridge-utils
安装创建TAP界面的工具:
代码:
sudo apt-get install uml-utilities
编辑网络界面配置文件(
代码:
sudo vi /etc/network/interfaces
),根据你的情况加入以下内容:
代码:
auto eth0
iface eth0 inet static //这里可以为DHCP
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user lm //lm是我的用户名,在这里换为你的用户名
auto br0
iface br0 inet static //当然这里也可以使用DHCP分配
bridge_ports eth0 tap0
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.1
br
ln
1.作用
ln命令用来在文件之间创建链接,它的使用权限是所有用户。
2.格式
ln [options] 源文件 [链接名]
3.参数
-f:链结时先将源文件删除。
-d:允许系统管理者硬链结自己的目录。
-s:进行软链结(Symbolic Link)。
-b:将在链结时会被覆盖或
|
(2012-04-15 09:22)
只要启动系统时,发现出现”Read-Only file
system”,congratulations,你fstab文件丢失,要不就是遭到破坏了。
然后就会停留在”starting system logger:”
下面说下解决办法:
拿安装光盘,启动到引导界面后输入:linux rescue 进入救援模式,根据提示一步步到终端模式下。
进入救援模式后,我发现整个/etc/fstsb文件丢失了,系统不存在该文件,故只能通过e2label来查询设备介质挂载分区。
1、fdisk -l 查看一下系统中的分区信息
,我就俩分区,一个根分区,一个交换分区,根分区为/dev/sda1。
2、用e2label /dev/sda1
确定其卷标是/,下面要手动编辑/etc/fstab文件,fstab位于sda1分区中,那么现在此分区是没有被挂
(2012-04-15 09:17)
错误信息截图:

unexpected inconsistency;RUN fsck MANUALLY
An error occurred during the filesystem check
Propping you to shell the system will reboot
when you leave the shell
Give root password for mantennance
在命令行输入
#mount | grep ''on /''
得到你root用户所在分区/dev/your_partition,然后输入
fsck -y /dev/your_partition
即,检测并修复磁盘/dev/your_partition,-y 选项指定检测每个文件是自动输入yes
系统提示重启,重启后还是不行
在命令行输入
fsck -y /dev/sda1
重启ok。
如果在fsck过程中丢失fstab文件,可参考下文,修复fstab。
[root@Rhel5 packages]# cat /etc/yum.conf | grep cachedir
cachedir=/var/cache/yum
这就是保存的地方,
[root@Rhel5 packages]# ll
total 100
-rw-r--r-- 1 root root 94864 Nov 13 05:16
hwbrowser-0.30-2.el5.noarch.rpm
[root@Rhel5 packages]# pwd
/var/cache/yum/rhel-debuginfo/packages
[root@Rhel5 packages]# cat /etc/yum.conf | grep keep
keepcache=1
还要把/etc/yum.conf中的keepcache改成1,默认是0即安装后不保存包头和软件包
http://www.cnblogs.com/syxchina/archive/2011/03/01/2197252.html
[功能]
center os下面的软件包管理工具。
[描述]
yum是一个基于rpm的交互的软件包管理工具。
1,常用的command(子命令)简介:
install package1 [package2] [...]