<pre id="bbfd9"><del id="bbfd9"><dfn id="bbfd9"></dfn></del></pre>

          <ruby id="bbfd9"></ruby><p id="bbfd9"><mark id="bbfd9"></mark></p>

          <p id="bbfd9"></p>

          <p id="bbfd9"><cite id="bbfd9"></cite></p>

            <th id="bbfd9"><form id="bbfd9"><dl id="bbfd9"></dl></form></th>

            <p id="bbfd9"><cite id="bbfd9"></cite></p><p id="bbfd9"></p>
            <p id="bbfd9"><cite id="bbfd9"><progress id="bbfd9"></progress></cite></p>

            在Linux中如何運用find命令

            時間:2025-12-21 01:03:04 操作系統 我要投稿

            在Linux中如何運用find命令

              在Linux中如何運用find命令

              我們都知道Linux下查找文件的命令是find命令,運用該命令可以很快的搜到自己想要的文件,那么find命令有哪些使用技巧呢?下面小編就給大家介紹下Linux中find命令的巧妙運用。

              find命令的工作方式是沿著文件層次結構向下遍歷,匹配符合條件的文件,并執行相應的操作。

              1、根據文件名或正則表達式匹配搜索

              選項-name的'參數指定了文件名所必須匹配的字符串,我們可以將通配符作為參數使用,“*.txt”匹配所有以.txt結尾的文件名。

              代碼如下:

              [root@localhost test]# touch {data,log,file,File,LOG}_{1,2,3,4,5,6}_{.txt,.pdf,.log,.conf}

              [root@localhost test]# find 。 -name “*.txt” –print

              如果想匹配多個條件中的一個,可以使用-o參數。

              代碼如下:

              [root@localhost test]# find 。 ( -name “*.txt” -o -name “*.log” )

              選項-iname忽略字母大小寫

              選項-path的參數可以使用通配符來匹配文件路徑或文件。

              2、否定參數

              find 用 “!”來否定參數,匹配所有不以.txt結尾的文件名。

              代碼如下:

              [root@localhost test]# find 。 ! -name “*.txt” –print

              3、基于目錄深度的搜索

              find命令在使用時會遍歷所有的子目錄,我們可以采用-maxdepth和-mindepth來限制find命令遍歷的深度。

              -maxdepth: 指定最大深度;

              -mindepth:指定最小深度。

              代碼如下:

              [root@localhost ~]# find 。 -maxdepth 1 -type f

              列出當前目錄的所有普通文件,這兩個命令要緊跟在目標路徑之后。

            【在Linux中如何運用find命令】相關文章:

            初學者如何快速學習Linux下的find命令04-08

            Linux中source命令的用法05-21

            Linux系統xlsatom命令如何使用03-30

            Linux系統中hexdump的命令匯總12-06

            linux中ipcs命令使用詳解05-04

            如何實現在Linux中不輸入密碼運行sudo命令09-13

            關于linux中tail 命令使用詳解04-02

            Linux系統中strace命令的使用代碼01-30

            關于Linux中echo命令怎么使用04-15

            • 相關推薦

                    <pre id="bbfd9"><del id="bbfd9"><dfn id="bbfd9"></dfn></del></pre>

                    <ruby id="bbfd9"></ruby><p id="bbfd9"><mark id="bbfd9"></mark></p>

                    <p id="bbfd9"></p>

                    <p id="bbfd9"><cite id="bbfd9"></cite></p>

                      <th id="bbfd9"><form id="bbfd9"><dl id="bbfd9"></dl></form></th>

                      <p id="bbfd9"><cite id="bbfd9"></cite></p><p id="bbfd9"></p>
                      <p id="bbfd9"><cite id="bbfd9"><progress id="bbfd9"></progress></cite></p>
                      飘沙影院