zoukankan      html  css  js  c++  java
  • linux下FIND命令的使用

    Find 的使用
    文件查找
    find .(当前目录) -name
    find . -name "*.txt" -print
    find . -name '[A-Z,a-z,1-100]*'.txt -print
    find . -name "1.txt" -prune -o -name "*.txt" -print
    目录查找
    find . -path"./aa " -prune -o -name "*.txt" -print
    find . -path"./aa " -prune -o -path "./bb" -prune -o -name "*.txt" -print

    权限查找
    find . -prem 775 -print
    不查找aaa下的文件   find . -path "./aa" -prune -0 -perm 775 -print
    find . -path "./aa" -prune -0 -path "./bb" -prune -o -perm 775 -print
    find . ( -path "./aaa" -o -path "./bbb" ) -prune -o -perm 775 -print

    按类型查找

    软连接  可以理解为快捷方式
    ln -s ./aaa/* ./ddd
    find .-type l -print

    按属主查找
    find / -user www -type f -print
    查找属主被删除
    find / -nouser -type f -print

    find / -group apache -type -f -print

    按照时间查找
    两天之内被改过的
    find .-mtime -2 -type f -print
    两天之前被改过的
    find .-mtime +2 -type f -print
    十分钟之前被改过的
    find . -cmin +10 -type f -print

    按照文件新旧查找

    查找比aa.txt新的文件
    find . -newer "aa.txt" -type f -print
    查找比aa.txt旧的文件
    find . ! -newer "aa.txt" -type f -print
    查找比aa.txt新的比bb.txt旧的文件
    find . -newer “aa.txt”! -newer“bb.txt" -type f -print

    按照文件大小查找
    在根目录小大于1M的
    find / -size +1M -type -print
    小于1M的文件
    find / -size -1M -type -print
    执行命令
    find . -name "1.txt" -ok rm {} ;                   新建  touch 12a.txt
    find . -name "12a.txt" -exec cp {}{}.bak ;

    grep 匹配
    cat 1.txt | grep all --color只要出现all   cat 1.txt | grep -w "all" 匹配单词
    cat -n
    取反
     cat 1.txt | grep -v -w "all"
    统计次数
     cat 1.txt | grep -c "all"
    显示行数
    grep -n "all"
    显示匹配的文件
    grep "all"1.txt 2.txt 3.txt
    grep -l "all"1.txt 2.txt 3.txt 只显示匹配出来的文件名

    grep -i "ALL" *.txt  不区分大小写的匹配

    系统服务管理

    chkconfig --list   显示当前运行的所有服务
    /etc/inittab
    netstat -antl   all n端口 t tcp协议 l listen状态
    chkconfig --add httpd 增加服务
    chkconfig --del httpd 删除
    chkconfig --level 12345

  • 相关阅读:
    IIS的各种身份验证详细测试
    HTTP Error 401.3 Unauthorized Error While creating IIS 7.0 web site on Windows 7
    C/S and B/S
    WCF ContractFilter mismatch at the EndpointDispatcher exception
    Configure WCF
    Inheritance VS Composition
    Unhandled Error in Silverlight Application, code 2103 when changing the namespace
    Java RMI VS TCP Socket
    Principles Of Object Oriented Design
    Socket处理发送和接收数据包,一个小实例:
  • 原文地址:https://www.cnblogs.com/ke-wu/p/5759170.html
Copyright © 2011-2022 走看看