redhat 5.5 time zone configuration
ls -F /usr/share/zoneinfo/ ln -sf /usr/share/zoneinfo/posix/Asia/Shanghai /etc/localtime date[@more@]u
sed 匹配行上下各添加一个空行的解释(转的)记录一下
sed '/regex/{x;p;x;G;}' 模式空间为sedline中的 pattern space ;保持空间为hold space 步骤1,模式空间取得regex匹配行,保持空间为空 步骤2,x执行,使保持空间和模式空间交换 步骤3,p执行,打印为空的模式空间,此时保持空间为regex匹配行 步骤4,x执行前,因为匹配行找不到,故模式空间为空,保持空间为第一次匹配regex行, 步骤5,x执行后,模式空间为第一次匹配regex行,保持空间为空行 步骤6,G执行后,把保持空间添加到模式空间匹配行之后, http://www.ixpub.net/thread-1470705-1-1.html[@more@]
sed command review
CommandWhat It Doessed –n '/sentimental/p' filexPrints to the screen all lines containing sentimental.The file filex does not change. Without the –n option, all lines with sentimental will be printed twice.sed '1,3d' filex > newfilexDeletes lines 1, 2, and 3 from filex and saves changes in newfilex.sed '/[Dd]aniel/d' filexDeletes lines containing Daniel or daniel.sed –n '15,20p' filexPrints only lines 15 through 20.sed '1,10s/Montana/MT/g' filexSubstitutes Montana with MT globally in lines
双引号的作用
" 双引号:除Dollar signs($),Back quotes(``),Backslashes()外,所有内容留给应用解释,包括IFS和CR回车。Backslash():相当于将跟随字符用单引号处理。[@more@]
grep 的常用元字符
MetacharacterFunctionExampleWhat It Matches^Beginning-of-line anchor'^love'Matches all lines beginning with love.$End-of-line anchor'love$'Matches all lines ending with love..Matches one character'l..e'Matches lines containing an l, followed by two characters, followed by an e.*Matches zero or more characters preceding the asterisk' *love'Matches lines with zero or more spaces, followed by the pattern love.[ ]Matches one character in the set'[Ll]ove'Matches lines containing love or Love.[^]Match
shell 日常积累
1.杀死所有oracle 进程ps -ef|grep oracle|grep -v grep|awk '{print "kill -9 "$2}'|sh2.计算CPU idle平均值vmstat 1 11|sed -e '1,3d'|awk '{sum+=$22};END{print "cpu idle is " sum/10}'3.awk 'BEGIN{total=0}{total+=$1}END{print total}'[@more@]
solaris 10 添加zfs swap
1.创建swappool zpool create -f swappool mirror c0t1d0s2 c1t1d0s22.创建swap volumezfs create -b 8192 -V 130G swappool/swap3.添加swap到/etc/vfstab文件中,使该swap能在系统重启的时候自动加载/dev/zvol/dsk/swappool/swap - - swap - no -[@more@]