
Bash
不加温水
这个作者很懒,什么都没留下…
展开
-
常用Shell命令1
awk过滤grep bid=12007 /usr/local/openresty/nginx/logs/error.log | awk -F '\\[ValidateTest\\] |, client' '{print $2}' > ~/Downloads/battle_12007_server.lognginx的启动和关闭:/usr/local/openresty/ngi原创 2016-06-02 12:48:14 · 370 阅读 · 0 评论 -
常用Shell命令2
递归查找文件find . -name “*.xml”不递归查找文件find . -maxdepth 1 -name “*.xml”-maxdepth:最大深度,为1时,为当前目录python 读取shell环境变量import osvar=os.environ['LEGLORY']print var获取shell脚本的执原创 2016-06-02 12:55:59 · 341 阅读 · 0 评论 -
自定义ll命令
动手创建ll,等价于ls -lcd ~vim .bash_profile在后面插入alias ll='ls -l'注意:=号左右不能有空格然后保存退出,source .bash_profile原创 2016-06-02 13:49:26 · 633 阅读 · 0 评论 -
常用Shell命令3
mac修改tab的空格数cd /usr/share/vim/insert:set tabstop=2set shiftwidth=2解决javadoc中文乱码问题javadoc *.java -encoding UTF-8 -charset UTF-8 访问数组元素echo ${a[0]}数组个数echo ${#a[@]}原创 2016-06-02 13:02:32 · 394 阅读 · 0 评论 -
Vim 小技巧
查找:/查找字符如果要忽略大小写,即要/c查找字符替换将xxx替换位空字符:%s/xxx//g原创 2016-07-23 18:59:08 · 332 阅读 · 0 评论 -
查找目录下大小超过10M的文件
find . -type f -size +10M -exec ls -lh {} \; | awk '{print $5,$9}原创 2016-06-17 19:23:38 · 9032 阅读 · 0 评论 -
getopts读取命令行参数
getopts只能读取短选项###### getopts#!/bin/bashwhile getopts "a:bc" argdo case $arg in a) echo "a's arg: $OPTARG" ;;原创 2016-07-15 18:42:45 · 413 阅读 · 0 评论