vim
- 对数字-1 ctrl+x
- 对数字+1 ctrl+a
- 统计多少个匹配字符 :%s/<match_word>//gn
git
- 查看提交记录 git log --pretty=oneline <文件名>
- 查看一次的提记录更改 git show <356f6def9d3fb7f3b9032ff5aa4b9110d4cca87e>
- 删除远端分支 git push origin --delete <branchName>
- 删除远端分支 git branch -r -d <branch_remote_name>
- 删除本地分支 git branch -d <branch_name>
- 强制删除本地分支 git branch -D <branch_name>
- 同步远端删除的分支 git remote prune origin
- 取消合并分支 git merge --abort
awk
- 打印需要的字段 grep "not_revs" 20180105.err.log |grep type=0|awk -F "rid=" '{print $2}'|awk -F "," '{print $1}'
telnet
- 查看端口是否通 telnet 192.168.1.10 80
split
- 按行分割文件 split -l 10 date.file
rename
- 批量修改文件名字 rename 's/<old_name>/<new_name>/' *
gdb
-
打印全部的数组内容 set print element 0
-
打印数组指定长度内容 p *array@len
-
display enable/disable display var_name/disable dispaly
-
记录gdb的过程 set logging on
-
保存历史命令 set history save on
aws dynamodb
- 安装命令行客户端 pip install awscli
- 配置环境appkey, secretkey aws configure
- 查看表结构 aws dynamodb describe-table --table-name <table-name>
- 查询记录 aws dynamodb get-item --table-name <table-name> --key '{ "key1": {"S": "abcd"}, "key2":{"S":"efgh"}}’
- 参考网址1
- 参考网址2
- web客户端镜像拉取 docker pull taydy/dynamodb-manager
- 运行web客户端镜像 docker run -t -p 8080:80 taydy/dynamodb-manager
- web客户端网址参考
netstat
- 常用方式 netstat -antp |grep 8080
-
常见参数
-a (all)显示所有选项,默认不显示LISTEN相关
-t (tcp)仅显示tcp相关选项
-u (udp)仅显示udp相关选项
-n 拒绝显示别名,能显示数字的全部转化成数字。
-l 仅列出有在 Listen (监听) 的服務状态
-p 显示建立相关链接的程序名
-r 显示路由信息,路由表
-e 显示扩展信息,例如uid等
-s 按各个协议进行统计
-c 每隔一个固定时间,执行该netstat命令。
提示:LISTEN和LISTENING的状态只有用-a或者-l才能看到
kafka
- kafka查看消息消费(新版kafka 2.0)
kafka-console-consumer -brokers "172.31.10.189:9092","172.31.10.190:9092","172.31.10.191:9092","172.31.17.238:9092","172.31.17.239:9092" --topic mytopic -offset oldest
- kafka查看消息消费(旧版kafka 0.10)
kafka-console-consumer --bootstrap-server "172.31.10.189:9092","172.31.10.190:9092","172.31.10.191:9092","172.31.17.238:9092","172.31.17.239:9092" --topic mytopic --from-beginning
nginx
- 重新载入配置文件 /usr/local/webserver/nginx/sbin/nginx -s reload
- 重启 Nginx /usr/local/webserver/nginx/sbin/nginx -s reopen
- 停止 Nginx /usr/local/webserver/nginx/sbin/nginx -s stop
zookeeper
- 重启zk
root@nvm-t-live-kafka-1:/data/zookeeper# ./bin/zkServer.sh start JMX enabled by default Using config: /data/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED root@nvm-t-live-kafka-1:/data/zookeeper# ps -ef|grep zk root 28507 1 18 03:02 pts/0 00:00:01 /bin/bash ./bin/zkServer.sh start root 28511 27490 0 03:02 pts/0 00:00:00 grep zk root@nvm-t-live-kafka-1:/data/zookeeper# ps -ef|grep zoo root 28507 1 20 03:02 pts/0 00:00:26 /usr/lib/jdk1.8.0/bin/java -Dzookeeper.log.dir=. -Dzookeeper.root.logger=INFO,CONSOLE -cp /data/zookeeper/bin/../build/classes:/data/zookeeper/bin/../build/lib/*.jar:/data/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/data/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/data/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/data/zookeeper/bin/../lib/log4j-1.2.16.jar:/data/zookeeper/bin/../lib/jline-0.9.94.jar:/data/zookeeper/bin/../zookeeper-3.4.6.jar:/data/zookeeper/bin/../src/java/lib/*.jar:/data/zookeeper/bin/../conf::.:/usr/lib/jdk1.8.0/lib:/usr/lib/jdk1.8.0/jre/lib -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /data/zookeeper/bin/../conf/zoo.cfg
mysql
- 查看用户权限: show grants
- 查看正在执行的任务 show processlist
- 查看mysql引擎innodb状态 show engine innodb status
- 查看慢查询设置 show variables like '%slow_query%s' 慢查询
- 查看innodb查询行 show status like '%sInnodb_rows_read%s'