精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

      rmdir命令詳解

      時間: 春健736 分享

        我們都知道Linux命令中的rm命令主要用于刪除文件,那么 rmdir命令又有什么作用呢?下面學(xué)習(xí)啦小編就給大家介紹下Linux命令中rmdir命令的主要功能吧。

        rmdir命令詳解

        rmdir是常用的命令,該命令的功能是刪除空目錄,一個目錄被刪除之前必須是空的。(注意,rm - r dir命令可代替rmdir,但是有很大危險性。)刪除某目錄時也必須具有對父目錄的寫權(quán)限。

        1.命令格式:

        rmdir [選項]... 目錄...

        2.命令功能:

        該命令從一個目錄中刪除一個或多個子目錄項,刪除某目錄時也必須具有對父目錄的寫權(quán)限。

        3.命令參數(shù):

        - p 遞歸刪除目錄dirname,當(dāng)子目錄刪除后其父目錄為空時,也一同被刪除。如果整個路徑被刪除或者由于某種原因保留部分路徑,則系統(tǒng)在標準輸出上顯示相應(yīng)的信息。

        -v, --verbose 顯示指令執(zhí)行過程

        4.命令實例:

        實例一:rmdir 不能刪除非空目錄

        命令:

        rmdir doc

        輸出:

        [root@localhost scf]# tree

        .

        |-- bin

        |-- doc

        | |-- info

        | `-- product

        |-- lib

        |-- logs

        | |-- info

        | `-- product

        `-- service

        `-- deploy

        |-- info

        `-- product

        12 directories, 0 files

        [root@localhost scf]# rmdir doc

        rmdir: doc: 目錄非空

        [root@localhost scf]# rmdir doc/info

        [root@localhost scf]# rmdir doc/product

        [root@localhost scf]# tree

        .

        |-- bin

        |-- doc

        |-- lib

        |-- logs

        | |-- info

        | `-- product

        `-- service

        `-- deploy

        |-- info

        `-- product

        10 directories, 0 files

        說明:

        rmdir 目錄名 命令不能直接刪除非空目錄

        實例2:rmdir -p 當(dāng)子目錄被刪除后使它也成為空目錄的話,則順便一并刪除

        命令:

        rmdir -p logs

        輸出:

        [root@localhost scf]# tree

        .

        |-- bin

        |-- doc

        |-- lib

        |-- logs

        | `-- product

        `-- service

        `-- deploy

        |-- info

        `-- product

        10 directories, 0 files

        [root@localhost scf]# rmdir -p logs

        rmdir: logs: 目錄非空

        [root@localhost scf]# tree

        .

        |-- bin

        |-- doc

        |-- lib

        |-- logs

        | `-- product

        `-- service

        `-- deploy

        |-- info

        `-- product

        9 directories, 0 files

        [root@localhost scf]# rmdir -p logs/product

        [root@localhost scf]# tree

        .

        |-- bin

        |-- doc

        |-- lib

        `-- service

        `-- deploy

        |-- info

        `-- product

        7 directories, 0 files

        上面就是Linux rmdir命令的作用介紹了,該命令只可刪除空目錄,不可刪除含有隱藏或系統(tǒng)文件的目錄,所以在使用的時候要格外注意。

      647584