亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓(xùn)課程 | 模擬考場 | 考試論壇  
        當(dāng)前位置:Linux認(rèn)證 > 紅帽認(rèn)證 > 紅帽認(rèn)證輔導(dǎo) > 文章內(nèi)容
        

      RHCE7認(rèn)證學(xué)習(xí)筆記:訪問文件系統(tǒng)

      來源:Linux社區(qū) [ 2016年2月14日 ] 【

            操作actions:

       

                      -delete:

                     

                      -exec command: 執(zhí)行多個命令,直到遇到帶;的命令

                      -exec comand {}  \; :

                      -execdir command:

                      -execdir comand {} \; :只執(zhí)行查找的文件的當(dāng)前目錄

                      -fprint:

                      -prune:修剪,只顯示文件所所指向的目錄:

          find的運算符:
              (expr):               

                  !:非

                  not:

                  expr1 expr2:并且

                  expr1 -a expr:并且

                  expr1 -and expr2:并且
                  expr1 -o expr2:或者

                  expr1 -or expr2:或者

          三種標(biāo)準(zhǔn)格式:POSIX,GNU,BSD

          環(huán)境變量:

              LANG:
              LC_ALL:
              PATH:
              POSIXLY_CORRECT: 設(shè)置了這個環(huán)境變量,那么 -perm +zzz這樣的模式會出錯
      Determines  the  block size used by -ls and -fls.  If POSIXLY_CORRECT is set, blocks are units of 512 bytes.  Other‐
                    wise they are units of 1024 bytes.

      When POSIXLY_CORRECT is not set, -perm +zzz is treated just like -perm /zzz if +zzz is not a  valid  symbolic  mode.
                    When POSIXLY_CORRECT is set, such constructs are treated as an error.

          常見使用例子:

              找到文件名為core的文件,并刪除:
      find /tmp -name core -type f -print | xargs /bin/rm -f

       

          如果文件或目錄含有單引號、雙引號、換行符,以下的find也能找到:
      find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

          找到當(dāng)前目錄下面的文件,并執(zhí)行file命令:

          find . -type f -exec file '{}' \;
          或:find . -type f -exec file {} \;

          遍歷跟目錄,查找setuid的文件和目錄并保存到/root/suid.txt,查找大于100M的文件并保存到/root/big.txt,%#m=文件權(quán)限前面加特殊標(biāo)記位,%u =UID,%p=文件名稱,%s=文件大。
          find / \( -perm -4000 -fprintf /root/suid.txt '%#m %u %p\n' \)  \
            \( -size +100M -fprintf /root/big.txt '%-10s %p\n' \)

          查找家目錄下面在最近24小時內(nèi)修改的文件:

      find $HOME -mtime 0

          尋找sbin目錄下面可執(zhí)行但是不可讀的文件,!是非的意思,使用轉(zhuǎn)義字符\進(jìn)行轉(zhuǎn)義:
      find /sbin /usr/sbin -executable \! -readable -print

          精確匹配:

      find . -perm 664

      find . -perm -664    至少包含644權(quán)限

      find . -perm /222    ugo的權(quán)限位只要滿足一個條件即可

      find . -perm /220
      find . -perm /u+w,g+w
      find . -perm /u=w,g=w

              find . -perm -444 -perm /222 ! -perm /111
              find . -perm -a+r -perm /a+w ! -perm /a+x

              find repo/ -exec test -d {}/.svn \; -or \
            -exec test -d {}/.git \; -or -exec test -d {}/CVS \; \
            -print -prune

      首頁 1 2 3 尾頁
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動訪問考試網(wǎng) | 復(fù)制本頁地址,傳給QQ/MSN上的好友 | 申請鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved