/usr/sbin/tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | egrep -i 'SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL'
netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more
netstat -tna | cut -b 49- |grep TIME_WAIT | sort |more netstat -an | grep TIME_WAIT | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more
netstat -an | grep ESTABLISHED | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -nr | more netstat -an | grep ":80" | grep ESTABLISHED | sort | more
ps -efww|grep sqlr-listener|grep -v grep|cut -c 9-15|xargs kill -9
netstat -anpo|grep php-cgi|wc -l
netstat -anlp | grep 80 | grep tcp | awk {'print $5'} | awk -F: {'print $1'}| sort |uniq -c | sort -nr
iptables -A INPUT -s IP地址 -j REJECT iptables -A INPUT -s IP地址/24 -j REJECT route add -net IP地址 netmask 255.255.255.0 reject
vmstat 1 10 iostat 1 10 netstat iptraf
tcpdump host 202.106.0.20 and port 53 -X -s 500 -l -nn -i eth1
tail -n 10000 access-www.log |awk '{print$7}' |sort |uniq -c | sort -nr|more
echo 'flush_all' | nc 127.0.0.1 11211
awk '{print $1}' /proc/loadavg
netstat -ntl|awk '$4~/:80$/ {print $6}'|sort|uniq -c
用cron处理定时任务,首先要保证cron操作已经运行。如果安装了cron 的话。正常情况下cron已经开机自运行了,如果没有运行的话。
/etc/init.d/cron start
用crontab来安排定时任务
.crontab [-u user] {-l| -r | -e} .-l:显示任务 .-e:编辑任务 .-r:清空任务
任务格式为: 分 时 日期 月份 星期 操作命令 eg:
##每天14点运行一次 * 14 * * * echo " look me" >> /home/lost/test ##表示每两分钟运行一次 0-59/2 * * * * echo "look me" >> /tmp/test ##表示2与15点运行一次 * 2,15 * * * echo "look me " >> /tmp/test
* : 表示任意 - : 表示区间. / :表示频率 , :表示枚举
http://linux.vbird.org/linux_basic/0430cron.php#cron
strace -p pid gdb -p pid
find . -name test.php -exec rm {} \; find . -name test.php | xargs rm -rf
.表示当前文件夹 -name 表示查找的文件名字 -type x 查找类型为 x 的文件,x 为下列字符之一: b 块设备文件 c 字符设备文件 d 目录文件 p 命名管道(FIFO) f 普通文件 l 符号链接文件(symbolic links) s socket文件
-exec 表示执行后续命令 -exec 命令名称 {} 对符合条件的文件执行所给的Linux 命令,而不询问用户是否需要执行该命令。 {}表示命令的参数即为所找到的文件;命令的末尾必须以“ \;”结束。
cd /find目录/ find . -name .svn -type d //确认是否能查找到.svn目录 并检测是否有误 find . -name .svn -type d -exec rm -fr {} \; //将查找到的文件夹删除
find aaa -type d -exec chmod 755 {} \;
sed -i 's/b/strong/g' index.html
此命令搜索 index.html 文件中的 b 并将其替换为 strong。
tar zcvf - ./data | ssh webserver "cat > xxx.tgz" tar zcvf - ./data | (cd ./aaa/; tar zxvf -)
grep -nr "aaa" . sed -i "s/aaa/bbb/g" `grep "aaa" -rl .`
file 文件名
find ./ -name '*.html' -exec grep "breadcrumbs.inc.php" '{}' \; -print
这条命令将查找所有包含 breadcrumbs.inc.php 的 HTML 文件。
find /path/to/file -type f -name "*.php" | xargs grep -nr '^'$'\t'
export PATH=`echo $PATH | sed -e 's/:\/aaa\/bbb//g'`
echo "abcdabc1234abc" | awk -F'a' '{print NF-1}'
echo abcdabc1234abc | grep -o 'a' | wc -l
echo "abcdaaaaaaaaabc1234abc" | awk '{print gsub("a","a")}'
echo abcdafsdfesd|perl -ne 'print tr/a//;'
str="abcdabc1234abc" str=${str//[^a]} echo ${#str}
wc -l `find orange/trunk/ -name "*.php" -o -name "*.js" -o -name "*.css" | grep -v "runtime"` | tail -n1