zoukankan      html  css  js  c++  java
  • 常用linux 命令


    ls -lt 时间倒序
    ls -ltr 时间正序
    ls -lS 大小倒序
    ls -li 显示inode

    cat smb_quicktest.py| grep -E 'form_re|my_sa|isi_simple'
    -i 忽略大小写
    [root@centos7 temp]# grep -i abcd file
    ABCD
    function abcd() {
    [root@centos7 temp]#

    选项-o表示只输出匹配的字符,而不是整行:
    [root@centos7 temp]# grep -oi abcd file
    ABCD
    abcd
    [root@centos7 temp]#
    选项-c统计匹配的行数:
    [root@centos7 temp]# grep -oic abcd file
    2
    [root@centos7 temp]#
    选项-v表示取反匹配,如输出/etc/passwd中不以/sbin/nologin结尾的行:
    [root@centos7 temp]# grep -v "/sbin/nologin$" /etc/passwd
    root❌0:0:root:/root:/bin/bash
    sync❌5:0:sync:/sbin:/bin/sync
    shutdown❌6:0:shutdown:/sbin:/sbin/shutdown
    halt❌7:0:halt:/sbin:/sbin/halt
    learner❌1000:1000::/home/learner:/bin/bash
    root@DTRDUCLI439077:/usr/local/ds_stress [master *%] # grep -v "rmdir" 111.txt

    FAIL:: 4244:Sun 05/26/2019 14:02:42.747: create: proto-g6-efsp01-t23.lorg.west.isilon.comifsagefs_test_b2ee17c2-802d-11e9-99b2-005056900298XPRO006-02proto-g6-efsp01smb_user_810000140dataPSVZf7Qf4xO9EpiN6tcyZvs.dip, expected=943616, actual=1014160, bs=235904, cnt=4, validated=0, coheren

    选项-w表示匹配整个单词:
    [root@centos7 temp]# grep here file
    here
    there
    [root@centos7 temp]# grep -w here file
    here
    [root@centos7 temp]#
    选项-n表示显示行号:
    [root@centos7 temp]# grep -n "[1]" /etc/passwd
    1:root❌0:0:root:/root:/bin/bash
    5:lp❌4:7:lp:/var/spool/lpd:/sbin/nologin
    24:learner❌1000:1000::/home/learner:/bin/bash
    选项-A N、-B N、-C N表示输出匹配行和其'周围行'
    -A N 表示输出匹配行和其之后(after)的N行
    -B N 表示输出匹配行和其之前(before)的N行
    -C N 表示输出匹配行和其之前之后各N行

    统计出现success的次数
    ali1-x0jjn6l-1# cat smb_quicktest.signing.log | grep -o success | grep -c success
    367
    
    
    文件夹下 文件夹的个数 recursive:
    ls -lR|grep "^d"|wc -l
    

    1. rl ↩︎

  • 相关阅读:
    数据库三范式(转)
    Tyrion中文文档(含示例源码)
    mongodb数据库导入导出恢复
    HTTP协议:Content-Type
    requests爬虫组件
    JS 数组对象
    JS 函数
    javascript window对象属性和方法
    js String对象
    Math对象-JavaScript
  • 原文地址:https://www.cnblogs.com/vivivi/p/11830845.html
Copyright © 2011-2022 走看看