随笔分类 - Shell
Communicate with kernel...
摘要:有文本文件,内容如下,需要找出response不为on的设备ip root@dev[15:49:33]$ cat result.txt index[8] ip[8.8.8.8] send response[ % Total % Received % Xferd Average Speed Time
阅读全文
摘要:摘自这里 /sys/class/net/network-interface/statistics root@Dev[09:41:51]$ ll /sys/class/net/eth0/statistics total 0 -r--r--r-- 1 root root 4096 Jun 29 14:5
阅读全文
摘要:1. 文件去重 sort file |uniq sort -n file |uniq 2. 文件按某一列去重 # 按照第二列去重 root@solitude[20:28:32]$ cat file beijing::198 shanghai::87 shenzhen::87 beijing::100
阅读全文
摘要:#!/bin/bash tput civis while [ 1 ] do tput clear # tput cup 10 20 info=(date "+%Y-%m-%d %H:%M:%S %A") LEN=`echo info | wc -c` COLS=`tput cols` let HOLD_COL=COLS-LEN ...
阅读全文
摘要:查看swap被占用的情况 使用: 查看指定进程的swap占用情况 使用:
阅读全文
摘要:root@standby[16:38:35] root@standby[16:38:35] cat tmp.log qq [8.8.8.8] 6.6.6.6 [1502301436.016] "GET / HTTP/1.1" 200 21 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like ...
阅读全文
摘要:2018-01-03@中关村 有文本 a.log 如下,请做词频统计,统计出每个单词出现的频率并倒序排序。 方法一 - 首先通过egrep把文本内容拆成每行列出一个单词 - egrep -o 表示只打印匹配到的字符,由换行符分割 - \b 是正则表达式里的单词边界符 - [:alpha:] 是表示字
阅读全文
摘要:获取本机私网地址(1个) 获取本机公网地址(1个或多个)
阅读全文
摘要:1 #!/bin/bash 2 # Author : standby 3 # Date : 2017-05-12 4 # Description : Deploy something. 5 6 . /etc/init.d/functions 7 8 # Usage... 9 function Usage() 10 { 11 ech...
阅读全文
摘要:1 #!/bin/bash 2 # chkconfig: 2345 40 98 3 # description: Start/Stop Nginx server 4 5 path=/application/nginx/sbin 6 pid=/application/nginx/logs/nginx.pid 7 RETVAL=0 8 9 . /etc/init.d/funct...
阅读全文
摘要:#!/bin/bash # Author : standby@gmail.com # Date : 2018-02-27 NGX_CONF="/usr/local/nginx/conf/nginx.conf" # Get the dev which contains ./liveroot/ function get_point() { arr=(`df ...
阅读全文
摘要:Shell + crontab 实现日志压缩归档 crontab shell
阅读全文
摘要:Shell结合Expect自动输入密码示例
阅读全文