有用的命令行

Random order:
     cat gui*.txt | cut -c 1-11  | grep 1 |sort |  uniq| while read i; do echo "$i $RANDOM"; done | sort -k2n | cut -d " " -f1| grep -v -e "^182" | split -l 50000 -d -a2

Delete blank lines:
     cat httpd.conf.bak.20120411 | grep -v "#" | sed -e '/^\n$/d' | sed /^[[:space:]]*$/d >httpd.conf

Delete duplicate lines:
     cat 1.txt | cut -c 1-11 | sort |  uniq >1-result.txt

Filter a file with another file:
     grep -v -Fx -f black_user.csv hn-all  >hn.txt
     grep -v -Fx -f black_user.csv ln-all | grep -v -e "^182" >ln.txt

Wget
     wget ftp://sibmes1:1234abcd@intracx21.cathaypacific.com//export/home/webappaix13/repos/log/xmlibe2.2/Performance.log.2012-01-17.backup.gz -c /home/hike/temp.gz

Date
     Format:date --date "4 day" '+%Y-%m-%d'
     Last Day of Month:cal | tail -2 | head -1 | awk '{print $NF}'
     Diff:
          echo $(($(date -d '2004-01-09' +%j)-$(date -d '2004-01-05' +%j)))
          echo $((($(date +%s)-$(date -d 2011-12-01 +%s))/86400))
tar/bz2
tar   jxvf   linux-2-4-2.tar.bz2
tar -zxvf /tmp/etc.tar.gz 
ps
          ps -aux

netstat
         netstat -ant
    
Sed
          cat 7th.htm | grep reverseAuthorize | cut -d"(" -f2| cut -d")" -f1 | sed -e s/\',\'\'//g | sed -e s/\'//g | split -40 -d -a4

awk
     cat 1.sql | sed -e s/\(/,/g | sed -e s/\)/,/g | awk -F "," '{print $2"="$7" and " $3"="$8" and "$4"="$9}'
     cat 1.sql | sed -e s/\(/,/g | sed -e s/\)/,/g | awk -F "," '{print "select * from "$2"="$7" and " $3"="$8" and "$4"="$9}'      

端口号  

     netstat -nltp |grep 端口号或服务名
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值