美文网首页
shell script 每日一问

shell script 每日一问

作者: 癞痢头 | 来源:发表于2019-12-11 13:46 被阅读0次

查看进程

按内存从小到大排列

ps -e -o "%C : %p : %z : %a"|sort -k5 -nr

按cpu使用率,从小到大

ps -e -o "%C : %p : %z : %a"|sort -nr

1.shell 怎么输出单引号

echo -e "'"

shell中的单引号中所有的字符都是普通字符,如果需要拼接单引号,则要用双引号引起来

ex:

### del all data from proms
ip=localhost

echo ">> 1. 删除所有数据"
echo 'curl -X POST -g http://'${ip}':9090/api/v1/admin/tsdb/delete_series?match[]={__name__=~".+"}'

### reload
echo ">> 2. 重新加载数据"
echo 'curl -X POST http://'${ip}':9090/-/reload'

### del job
## curl -g, --globoff       Disable URL sequences and ranges using {} and []
echo ">> 3. del 指标by job"
echo 'curl -X POST -g '"'"'http://'${ip}':9090/api/v1/admin/tsdb/delete_series?match[]={job="com.ktkt.api.video"}'"'"

输出结果

  1. 删除所有数据
    curl -X POST -g http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]={name=~".+"}
  2. 重新加载数据
    curl -X POST http://localhost:9090/-/reload
  3. del 指标by job
    curl -X POST -g 'http://localhost:9090/api/v1/admin/tsdb/delete_series?match[]={job="com.ktkt.api.video"}'

测试ssh 的配置是否畅通

ssh -Tv git@106.75.48.2 -p 10022 -i 

linux 大文件中间行截取

sed -n '771997,772009p' debug.log.2020-05-13.002 

相关文章

网友评论

      本文标题:shell script 每日一问

      本文链接:https://www.haomeiwen.com/subject/uwpogctx.html