国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

linux命令----- mkdir與rmdir

這篇具有很好參考價值的文章主要介紹了linux命令----- mkdir與rmdir。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

一 mkdir

mkdir是make directories的縮寫,主要用于linux中創(chuàng)建目錄

  • 創(chuàng)建的目錄不能和同級目錄中已經(jīng)存在的目錄重名
  • 可以mkdir p 遞歸的同時創(chuàng)建多個目錄

linux命令----- mkdir與rmdir

1.mkdir 目錄名

[root@localhost /]# mkdir test
[root@localhost /]# ll
總用量 20
lrwxrwxrwx.   1 root root    7 415 20:34 bin -> usr/bin
dr-xr-xr-x.   5 root root 4096 415 20:39 boot
drwxr-xr-x.  20 root root 3200 422 18:58 dev
drwxr-xr-x.  74 root root 8192 422 18:58 etc
drwxr-xr-x.   2 root root    6 411 2018 home
lrwxrwxrwx.   1 root root    7 415 20:34 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 415 20:34 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 411 2018 media
drwxr-xr-x.   2 root root    6 411 2018 mnt
drwxr-xr-x.   2 root root 4096 420 18:57 opt
dr-xr-xr-x. 104 root root    0 422 18:58 proc
dr-xr-x---.   3 root root  184 421 00:58 root
drwxr-xr-x.  24 root root  660 422 18:58 run
lrwxrwxrwx.   1 root root    8 415 20:34 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 411 2018 srv
dr-xr-xr-x.  13 root root    0 422 18:58 sys
drwxr-xr-x.   2 root root    6 422 19:54 test
drwxrwxrwt.   9 root root  232 422 19:39 tmp
drwxr-xr-x.  18 root root  233 420 05:54 usr
drwxr-xr-x.  20 root root  278 420 03:03 var

2.mkdir -p 目錄一/目錄二

出現(xiàn)了test/test1/test2的嵌套

[root@localhost test]# mkdir -p test1/test2
[root@localhost test]# ll
總用量 0
drwxr-xr-x. 3 root root 19 422 19:58 test1
[root@localhost test]# cd /test2
-bash: cd: /test2: 沒有那個文件或目錄
[root@localhost test]# cd test1
[root@localhost test1]# cd test2
[root@localhost test2]# 

二 rmdir

rmdir是remove directories的縮寫,主要用于linux中刪除目錄
這個命令只能刪除空目錄。不能刪除非空目錄

1.rmdir 目錄名

[root@localhost test2]# mkdir test4
[root@localhost test2]# ll
總用量 0
drwxr-xr-x. 2 root root 6 422 20:03 test
drwxr-xr-x. 2 root root 6 422 20:02 test2
drwxr-xr-x. 2 root root 6 422 20:03 test3
drwxr-xr-x. 2 root root 6 422 20:05 test4
drwxr-xr-x. 2 root root 6 422 20:02 –v
[root@localhost test2]# rmdir test4
[root@localhost test2]# ll
總用量 0
drwxr-xr-x. 2 root root 6 422 20:03 test
drwxr-xr-x. 2 root root 6 422 20:02 test2
drwxr-xr-x. 2 root root 6 422 20:03 test3
drwxr-xr-x. 2 root root 6 422 20:02 –v

2.刪除非空目錄時失敗

[root@localhost test]# ll
總用量 0
drwxr-xr-x. 2 root root  6 422 20:12 edu
drwxr-xr-x. 3 root root 19 422 19:58 test1
[root@localhost test]# tree
.
├── edu
└── test1
    └── test2
        ├── test
        ├── test2
        ├── test3
        └── \342\200\223v

7 directories, 0 files
[root@localhost test]# rmdir test1
rmdir: 刪除 "test1" 失敗: 目錄非空

3. rmkdir -p 目錄1/目錄2

示范:文章來源地址http://www.zghlxwxcb.cn/news/detail-428008.html

rmdir -p edu/teacher/
[root@localhost test]# cd edu
[root@localhost edu]# mkdir teacher
[root@localhost edu]# tree
.
└── teacher

1 directory, 0 files
[root@localhost edu]# cd ../
[root@localhost test]# tree
.
├── edu
│   └── teacher
└── test1
    └── test2
        ├── test
        ├── test2
        ├── test3
        └── \342\200\223v

8 directories, 0 files
[root@localhost test]# rmdir -p /edu/teacher
rmdir: 刪除目錄 "/" 失敗: 設(shè)備或資源忙
[root@localhost test]# rmdir -p edu/teacher/
[root@localhost test]# ll
總用量 0
drwxr-xr-x. 3 root root 19 422 19:58 test1
[root@localhost test]# tree
.
└── test1
    └── test2
        ├── test
        ├── test2
        ├── test3
        └── \342\200\223v

6 directories, 0 files
[root@localhost test]# 

到了這里,關(guān)于linux命令----- mkdir與rmdir的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 一分鐘學(xué)一個 Linux 命令 - mkdir 和 touch

    大家好,我是god23bin。歡迎來到《 一分鐘學(xué)一個 Linux 命令 》系列,今天需要你花兩分鐘時間來學(xué)習(xí)下,因為今天要講的是兩個命令, mkdir 和 touch 命令。前一個命令是操作目錄的,后一個命令是操作文件的。 建議學(xué)完手敲一篇加深記憶噢! mkdir 是 make directory 的縮寫,顧名思

    2024年02月07日
    瀏覽(25)
  • 【Shell 命令集合 磁盤管理 】Linux 創(chuàng)建目錄 mkdir 命令使用指南

    【Shell 命令集合 磁盤管理 】Linux 創(chuàng)建目錄 mkdir 命令使用指南

    Shell 命令專欄:Linux Shell 命令全解析 mkdir命令是Linux系統(tǒng)中的一個用于創(chuàng)建目錄的命令。它的作用是在指定的路徑下創(chuàng)建一個新的目錄。 使用mkdir命令可以方便地創(chuàng)建一個空的目錄,該目錄可以用于存儲文件或其他目錄。通過指定路徑參數(shù),可以在當前工作目錄或其他指定目

    2024年02月08日
    瀏覽(61)
  • linux 文件管理命令:rmdir \ chattr \ cksum \ cmp \ split

    作用:刪除一個或者多個目錄。 用法:rmdir [選項]…目錄… 主要選項如下: 命令 描述 --ignore-fail-on-non-empty 忽略任何因目錄仍有數(shù)據(jù)而造成的錯誤 -p, --parents 刪除指定目錄后,若該目錄的上層目錄已變成空目錄,則將其一并刪除 -v, --verbose 顯示命令執(zhí)行過程 --help 顯示此幫助信

    2024年02月13日
    瀏覽(17)
  • Linux mkdir命令教程:如何創(chuàng)建目錄(附實例詳解和注意事項)

    mkdir 命令在Linux系統(tǒng)中用于創(chuàng)建新的目錄。 mkdir 是\\\"make directory\\\"的縮寫,它可以幫助您通過一條命令就能創(chuàng)建目錄。 mkdir 命令在所有主流的Linux發(fā)行版中都可以使用,包括但不限于Debian、Ubuntu、Alpine、Arch Linux、Kali Linux、RedHat/CentOS、Fedora、Raspbian。這個命令是預(yù)裝在這些系統(tǒng)中

    2024年04月22日
    瀏覽(57)
  • 【Linux】Linux基礎(chǔ)命令-cp、ls、mv、chmod、rm、mkdir、cd、find、pwd

    【Linux】Linux基礎(chǔ)命令-cp、ls、mv、chmod、rm、mkdir、cd、find、pwd

    1.添加用戶 (1)切換到管理員 sudo su (2)添加用戶 addusr zhangdi (3)設(shè)置密碼 (4)切換到自己的賬號 su zhangdi 2. mkdir、cd 命令,要求能建立目錄、進入與退出目錄 (1)打開終端”應(yīng)用程序”→ “附件”→“終端”,在終端用命令新建目錄kkk (2)進入目錄mydir,并在mydir目

    2024年02月12日
    瀏覽(48)
  • 執(zhí)行hdfs dfs -mkdir input時彈出mkdir: `hdfs://localhost:9000/user/root‘: No such file or directory的解決方法

    執(zhí)行hdfs dfs -mkdir input時彈出mkdir: `hdfs://localhost:9000/user/root‘: No such file or directory的解決方法

    本文涉及的操作步驟來源于:https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SingleCluster.html#Execution 在執(zhí)行Pseudo-Distributed Operation的Execution以下步驟時,彈出了 mkdir: hdfs://localhost:9000/user/root\\\': No such file or directory 錯誤。 好久才反應(yīng)過來,原來是在上一步?jīng)]有理解清楚 us

    2024年02月07日
    瀏覽(32)
  • k8s常用命令的縮寫寫法

    k8s 中,有不少命令是有縮寫寫法的,比如 kubectl get services? 可以寫成 kubectl get svc, 那么其它一些命令是否也存在對應(yīng)的縮寫呢?其實部分較長的命令都會有,參考下面表格 命令 縮寫 kubectl get pods kubectl get po kubectl get services kubectl get svc kubectl get deployments kubectl get deploy kubectl

    2024年02月07日
    瀏覽(23)
  • 【Linux】Linux基本操作(二):rm rmdir man cp mv cat echo

    【Linux】Linux基本操作(二):rm rmdir man cp mv cat echo

    承接上文: 【【Linux】Linux基本操作(一):初識操作系統(tǒng)、ls、cd、touch、mkdir、pwd 】 目錄 1.rmdir指令 rm 指令: rmdir -p? ?#當子目錄被刪除后如果父目錄也變成空目錄的話,就連帶父目錄一起刪除。 rm rm -f? ? ? ?#即使文件屬性為只讀(即寫保護),亦直接刪除 rm -i? ? ? ?#刪

    2024年01月21日
    瀏覽(15)
  • Linux使用解壓命令unzip報錯:unzip: cannot find zipfile directory in one of xxx.zip

    在linux服務(wù)器下使用rz上傳壓縮文件,用unzip命令解壓zip包 報這種錯誤說明在文件上傳或下載的過程中出現(xiàn)了文件丟失的情況,需要使用 sftp或scp重新上傳文件到服務(wù)器 ,然后使用unzip命令或jar命令解壓壓縮文件

    2024年02月16日
    瀏覽(39)
  • Mac,Linux中用mkdir同時創(chuàng)建多個文件夾

    Mac,Linux中用mkdir同時創(chuàng)建多個文件夾

    提示:Mac,Linux中用mkdir同時創(chuàng)建多個文件夾 新建dirlist.txt 文件,放在所需創(chuàng)建文件夾根目錄 右擊-打開所需創(chuàng)建文件夾下終端 使用更為更強大的xargs命令

    2023年04月08日
    瀏覽(278)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包