zoukankan      html  css  js  c++  java
  • linux 文件搜索命令

    • 文件搜索命令 locate
    1. locate 文件名    在后台数据库中按文件名搜索,搜索速度快
    2. locate实际搜索的数据库 /var/lib/mlocate ,不同的linux版本可能有区别
    3. upda00000tedb 更新数据库
    4. 配置文件 /etc/updatedb.conf
    • 命令搜索命令 whereis 与 which
    1. whereis 命令 搜索命令所在路径及帮助文档 
    2. which 命令 可查看别·名
    • 文件搜索命令 find
    1. find 搜索目录 搜索条件 : find . -name install*
    2. 通配符 * ? []
    3. find /root -iname 文件名 不区分大小写
    4. find /root -user root 按照用户搜索
    5. find /root -nouser 搜索没有属主的文件
    6. find /var/log/ -mtime +10 查找十天前修改的文件 -10为十天内修改的文件,10为10天前当天修改的文件
    7. atime 文件访问时间 ctime 改变文件属性 mtime 修改文件内容
    8. find . -size 25k 所有大小为25K的文件 支持 +- ,k小写,M大写
    9. find . -inum 32234 按照INode搜索文件
    10. find /etc -size +20k -a -size -50k 查找大于20k并小于50k的文件 -a :and 逻辑与 -o :or 逻辑或
    11. find . -name a.txt -exec 命令 {} ;  对第一条命令的接口进行操作
    • 字符串搜索命令 grep
    1. grep 搜索字符串 从指定文件搜索 grep "aaa" *.log
    2. -v 取反,查询不包含某字符的结果
    3. -i 不区分大小写
    4. -m 最多匹配几个后,就停止
    5. -R 遍历
    6. -A num 显示结果行的后num行;-B num 与A相反;-C num 前后各num行;
    7. --color 搜索字符高亮
    8. -e 接正则表达式,可有多个
  • 相关阅读:
    Porter Stemming Algorithm
    Hook API to detect memory leak
    Are tuples more efficient than lists in Python?
    boost::intrusive_ptr VS boost::shared_ptr
    How Python GC deal with referencecycles?
    LINQ排序数组
    Sublime Text 2 (Version 2.0.1 build 2217) x64 破解注册方法
    GC in C# and Python
    Python中的else
    Managed C++ Destructor
  • 原文地址:https://www.cnblogs.com/fengdeng/p/6626646.html
Copyright © 2011-2022 走看看