最常用的10大shell命令:
1 grep key ./file* -IR
2 find . -name "xxx" --exec rm -rf {} \;
3 rsync -avP -e ssh --exclude="config" /src/* /dest/
4 tail -5 /etc/passwd | awk -F: 'BEGIN{t=0}{t=t+$3}END{print t}'
5 sed -i 's/abc/123/' tmp
6 ps aux |grep mysql
7 df  -lh
8 du /usr/local/ -lh --max-depth=1
9 cat /etc/passwd | sort |uniq -c |wc -l
10 netstat -an | awk '/^tcp/ {++arr[$NF];++arr["TOTAL_REQ"]} END{for(key in arr)print key,"\t",arr[key]}' | sort



测试脚本:
#!/bin/bash
#stat by datestr
function stathour()
{
    datestr=$1
    for file in `ls ./thumnail_log/TESTSERVER_downloadstat_${datestr}* | awk '{print $NF}'`
    do
echo $file
awk '{print $10}' $file |sort -n |uniq -c
    done
}
function statday()
{
    datestr=$1
    echo $datestr
    awk '{print $10}' ./thumnail_log/TESTSERVER_downloadstat_${datestr}* |sort -n |uniq -c
}
function statperson()
{
    datestr=$1
    echo $datestr
    awk '{if($10=1)print $1,$10}' ./thumnail_log/TESTSERVER_downloadstat_${datestr}* |sort -n |uniq -c |sort -n |wc -l
}
function getstartday()
{
    local startday=""
    if [ $# -lt 1 ]
    then
       startday="2012-03-09"
    else
       startday=$1
    fi
    echo $startday
}
today=`date -d "tomorrow" +'%Y-%m-%d'`
startday=`getstartday $1`
cmd=$2
if [ -z $2 ];then
    cmd="d"
fi
echo "cmd:$cmd"
while [ $startday != $today ]
do
   #echo $startday
   case $cmd in
      h) stathour $startday;;
      d) statday $startday;;
      p) statperson $startday;;
      *) echo 'wrong cmd!';;
   esac
   startday=$(date -d "$startday +1 day" +%Y-%m-%d)
done