^1640692625650
@
sname
yunwei42
slabel
运维常用42个命令
stype
thingDesc
sgroup
Linux常用命令.常用命令
sicon
icons/html.png
Sdescription
#$@text#$@
<p style="margin: 0px; text-align: left;">1.删除0字节文件<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode24" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">find -type f -size 0 -exec rm -rf {} \;</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">2.查看进程<br />
按内存从大到小排列<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode25" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">ps -e -o &quot;%C : %p : %z : %a&quot;|sort -k5 -nr</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">3.按cpu利用率从大到小排列<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode26" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">ps -e -o &quot;%C : %p : %z : %a&quot;|sort -nr</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">4.打印说cache里的URL<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode27" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">grep -r -a jpg /data/cache/* | strings | grep &quot;http:&quot; | awk -F&#39;http:&#39; &#39;{print &quot;http:&quot;$2;}&#39;</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">5.查看http的并发请求数及其TCP连接状态：<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode28" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">netstat -n | awk &#39;/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}&#39;</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">6. sed -i &#39;/Root/s/no/yes/&#39; /etc/ssh/sshd_config&nbsp;&nbsp; sed在这个文里Root的一行，匹配Root一行，将no替换成yes.</p>

<p style="margin: 0px; text-align: left;">7.如何杀掉mysql进程：<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode29" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">ps aux |grep mysql |grep -v grep |awk &#39;{print $2}&#39; |xargs kill -9 (从中了解到awk的用途)<br />
killall -TERM mysqld<br />
kill -9 `cat /usr/local/apache2/logs/httpd.pid` 试试查杀进程PID</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">8.显示运行3级别开启的服务:<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode30" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">ls /etc/rc3.d/S* |cut -c 15- (从中了解到cut的用途，截取数据)</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">9.如何在编写SHELL显示多个信息，用EOF<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode31" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">cat &lt;&lt; EOF<br />
+--------------------------------------------------------------+<br />
| === Welcome to Tunoff services === |<br />
+--------------------------------------------------------------+<br />
EOF</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">10. for 的巧用(如给mysql建软链接)<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode32" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">cd /usr/local/mysql/bin<br />
for i in *<br />
do ln /usr/local/mysql/bin/$i /usr/bin/$i<br />
done</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">11. 取IP地址：<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode33" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">ifconfig eth0 |grep &quot;inet addr:&quot; |awk &#39;{print $2}&#39;|cut -c 6-<br />
或者<br />
ifconfig | grep &#39;inet addr:&#39;| grep -v &#39;127.0.0.1&#39; | cut -d: -f2 | awk &#39;{ print $1}&#39;</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">12.内存的大小:<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode34" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">free -m |grep &quot;Mem&quot; | awk &#39;{print $2}&#39;</div>

<p><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">13.查看连接某服务端口最多的的IP地址</span><br style="text-align: left;" />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode35" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">netstat -an -t | grep &quot;:80&quot; | grep ESTABLISHED | awk &#39;{printf &quot;%s %s\n&quot;,$5,$6}&#39; | sort</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">14.查看Apache的并发请求数及其TCP连接状态：<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode36" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">netstat -n | awk &#39;/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}&#39;</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">15.因为同事要统计一下服务器下面所有的jpg的文件的大小,写了个shell给他来统计.原来用xargs实现,但他一次处理一部分,搞的有多个总和....,下面的命令就能解决啦.<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode37" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">find / -name *.jpg -exec wc -c {} \;|awk &#39;{print $1}&#39;|awk &#39;{a+=$1}END{print a}&#39;</div>

<p><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">CPU的数量（多核算多个CPU，cat /proc/cpuinfo |grep -c processor）越多，系统负载越低，每秒能处理的请求数也越多。</span></p>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">16.CPU负载&nbsp;&nbsp; # cat /proc/loadavg<br />
检查前三个输出值是否超过了系统逻辑CPU的4倍。&nbsp;</p>

<p style="margin: 0px; text-align: left;">18.CPU负载&nbsp;&nbsp; #mpstat 1 1<br />
检查%idle是否过低(比如小于5%)<br />
19.内存空间&nbsp;&nbsp; # free<br />
检查free值是否过低&nbsp;&nbsp; 也可以用 # cat /proc/meminfo<br />
20.swap空间&nbsp;&nbsp; # free<br />
检查swap used值是否过高&nbsp;&nbsp; 如果swap used值过高，进一步检查swap动作是否频繁：<br />
# vmstat 1 5<br />
观察si和so值是否较大<br />
21.磁盘空间&nbsp;&nbsp; # df -h<br />
检查是否有分区使用率(Use%)过高(比如超过90%)&nbsp;&nbsp; 如发现某个分区空间接近用尽，可以进入该分区的挂载点，用以下命令找出占用空间最多的文件或目录：<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode38" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"># du -cks * | sort -rn | head -n 10</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">22.磁盘I/O负载&nbsp;&nbsp; # iostat -x 1 2<br />
检查I/O使用率(%util)是否超过100%</p>

<p style="margin: 0px; text-align: left;">23.网络负载&nbsp;&nbsp; # sar -n DEV<br />
检查网络流量(rxbyt/s, txbyt/s)是否过高</p>

<p style="margin: 0px; text-align: left;">24.网络错误&nbsp;&nbsp; # netstat -i<br />
检查是否有网络错误(drop fifo colls carrier)&nbsp;&nbsp; 也可以用命令：# cat /proc/net/dev</p>

<p style="margin: 0px; text-align: left;">25.网络连接数目&nbsp;&nbsp; # netstat -an | grep -E &ldquo;^(tcp)&rdquo; | cut -c 68- | sort | uniq -c | sort -n</p>

<p style="margin: 0px; text-align: left;">26.进程总数&nbsp;&nbsp; # ps aux | wc -l<br />
检查进程个数是否正常 (比如超过250)</p>

<p style="margin: 0px; text-align: left;">27.可运行进程数目&nbsp;&nbsp; # vmwtat 1 5<br />
列给出的是可运行进程的数目，检查其是否超过系统逻辑CPU的4倍</p>

<p style="margin: 0px; text-align: left;">28.进程&nbsp;&nbsp; # top -id 1<br />
观察是否有异常进程出现</p>

<p style="margin: 0px; text-align: left;">29.网络状态&nbsp;&nbsp; 检查DNS, 网关等是否可以正常连通</p>

<p style="margin: 0px; text-align: left;">30.用户&nbsp;&nbsp; # who | wc -l<br />
检查登录用户是否过多 (比如超过50个)&nbsp;&nbsp; 也可以用命令：# uptime</p>

<p style="margin: 0px; text-align: left;">31.系统日志&nbsp;&nbsp; # cat /var/log/rflogview/*errors<br />
检查是否有异常错误记录&nbsp;&nbsp; 也可以搜寻一些异常关键字，例如：<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode39" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"># grep -i error /var/log/messages<br />
# grep -i fail /var/log/messages</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">32.核心日志&nbsp;&nbsp; # dmesg<br />
检查是否有异常错误记录</p>

<p style="margin: 0px; text-align: left;">33&nbsp;&nbsp; 系统时间&nbsp;&nbsp; # date<br />
检查系统时间是否正确</p>

<p style="margin: 0px; text-align: left;">34.打开文件数目&nbsp;&nbsp; # lsof | wc -l<br />
检查打开文件总数是否过多</p>

<p style="margin: 0px; text-align: left;">35.日志&nbsp;&nbsp; # logwatch &ndash;print&nbsp;&nbsp; 配置/etc/log.d/logwatch.conf，将 Mailto 设置为自己的email 地址，启动mail服务(sendmail或者postfix)，这样就可以每天收到日志报告了。<br />
缺省logwatch只报告昨天的日志，可以用# logwatch &ndash;print &ndash;range all 获得所有的日志分析结果。<br />
可以用# logwatch &ndash;print &ndash;detail high 获得更具体的日志分析结果(而不仅仅是出错日志)。</p>

<p style="margin: 0px; text-align: left;">36.杀掉80端口相关的进程<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode40" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">lsof -i :80|grep -v &quot;PID&quot;|awk &#39;{print &quot;kill -9&quot;,$2}&#39;|sh</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">37.清除僵死进程。<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode41" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">ps -eal | awk &#39;{ if ($2 == &quot;Z&quot;) {print $4}}&#39; | kill -9</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">38.tcpdump 抓包 ，用来防止80端口被人攻击时可以分析数据<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode42" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"># tcpdump -c 10000 -i eth0 -n dst port 80 &gt; /root/pkts</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">39.然后检查IP的重复数 并从小到大排序 注意 &quot;-t\ +0&quot;&nbsp;&nbsp; 中间是两个空格<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode43" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;"># less pkts | awk {&#39;printf $3&quot;\n&quot;&#39;} | cut -d. -f 1-4 | sort | uniq -c | awk {&#39;printf $1&quot; &quot;$2&quot;\n&quot;&#39;} | sort -n -t\ +0</div>

<p style="margin: 0px; text-align: left;">&nbsp;</p>

<p style="margin: 0px; text-align: left;">40.查看有多少个活动的php-cgi进程<br />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode44" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">netstat -anp | grep php-cgi | grep ^tcp | wc -l<br />
chkconfig --list | awk &#39;{if ($5==&quot;3:on&quot;) print $1}&#39;</div>

<p><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">41.kudzu查看网卡型号</span><br style="text-align: left;" />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode45" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">kudzu --probe --class=network</div>

<p><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">42.常用正则表达式</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配中文字符的正则表达式： [\u4e00-\u9fa5]</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：匹配中文还真是个头疼的事，有了这个表达式就好办了</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配双字节字符(包括汉字在内)：[^\x00-\xff]</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：可以用来计算字符串的长度（一个双字节字符长度计2，ASCII字符计1）</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配空白行的正则表达式：\n\s*\r</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：可以用来删除空白行</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配HTML标记的正则表达式：&lt;(\S*?)[^&gt;]*&gt;.*?&lt;/\1&gt;|&lt;.*? /&gt;</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：网上流传的版本太糟糕，上面这个也仅仅能匹配部分，对于复杂的嵌套标记依旧无能为力</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配首尾空白字符的正则表达式：^\s*|\s*$</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：可以用来删除行首行尾的空白字符(包括空格、制表符、换页符等等)，非常有用的表达式</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配Email地址的正则表达式：\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：表单验证时很实用</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配网址URL的正则表达式：[a-zA-z]+://[^\s]*</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：网上流传的版本功能很有限，上面这个基本可以满足需求</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配帐号是否合法(字母开头，允许5-16字节，允许字母数字下划线)：^[a-zA-Z][a-zA-Z0-9_]{4,15}$</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：表单验证时很实用</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配国内电话号码：\d{3}-\d{8}|\d{4}-\d{7}</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：匹配形式如 0511-4405222 或 021-87888822</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配腾讯QQ号：[1-9][0-9]{4,}</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：腾讯QQ号从10000开始</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配中国邮政编码：[1-9]\d{5}(?!\d)</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：中国邮政编码为6位数字</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配身份证：\d{15}|\d{18}</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：中国的身份证为15位或18位</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配ip地址：\d+\.\d+\.\d+\.\d+</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：提取ip地址时有用</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配特定数字：</span><br style="text-align: left;" />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode46" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">^[1-9]\d*$　 　 //匹配正整数<br />
^-[1-9]\d*$ 　 //匹配负整数<br />
^-?[1-9]\d*$　　 //匹配整数<br />
^[1-9]\d*|0$　 //匹配非负整数（正整数 + 0）<br />
^-[1-9]\d*|0$　　 //匹配非正整数（负整数 + 0）<br />
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$　　 //匹配正浮点数<br />
^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$　 //匹配负浮点数<br />
^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$　 //匹配浮点数<br />
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$　　 //匹配非负浮点数（正浮点数 + 0）<br />
^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$　　//匹配非正浮点数（负浮点数 + 0）</div>

<p><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：处理大量数据时有用，具体应用时注意修正</span><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">匹配特定字符串：</span><br style="text-align: left;" />
&nbsp;</p>

<div class="msgheader" style="background: rgb(246, 251, 255); font: 14px/25.2px tahoma, arial, 宋体; margin: 3px auto 0px; padding: 0px 3px; border: 1px solid rgb(0, 153, 204); border-image: none; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">
<div class="right" style="margin: 0px; padding: 0px; line-height: 25.2px; font-size: 14px; float: right;"><span style="font-size:12px"><u>复制代码</u></span></div>
代码如下:</div>

<div class="msgborder" id="phpcode47" style="background: rgb(221, 237, 251); font: 14px/25.2px tahoma, arial, 宋体; margin: 0px auto 3px; padding: 0px 3px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; overflow: hidden; clear: both; word-spacing: 0px; border-right-color: rgb(0, 153, 204); border-bottom-color: rgb(0, 153, 204); border-left-color: rgb(0, 153, 204); border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; white-space: normal; -ms-word-break: break-all; -ms-word-wrap: break-word; widows: 1; font-size-adjust: none; font-stretch: normal; -webkit-text-stroke-width: 0px;">^[A-Za-z]+$　　//匹配由26个英文字母组成的字符串<br />
^[A-Z]+$　　//匹配由26个英文字母的大写组成的字符串<br />
^[a-z]+$　　//匹配由26个英文字母的小写组成的字符串<br />
^[A-Za-z0-9]+$　　//匹配由数字和26个英文字母组成的字符串<br />
^\w+$　　//匹配由数字、26个英文字母或者下划线组成的字符串</div>

<p><br style="text-align: left;" />
<span style="background-color:rgb(255, 255, 255); color:rgb(0, 0, 0); float:none; text-align:left">评注：最基本也是最常用的一些表达式</span></p>
#$@text#$@
sdescriptors
xworker.lang.content.QuickContent
sinheritDescription
false
sth_createIndex
true
sth_registThing
command|xworker.jsch.JCtermRootWord
sth_registMyChilds
false
sth_registDisabled
false
sth_mark
false
