一. 文件和目錄類(lèi)
1. File exist 文件已經(jīng)存在
[root@oldboyedu59 ~]# mkdir? /data? /lidao? [root@oldboyedu59 ~]# mkdir? /data? /lidao? mkdir:cannot create directory ‘/data’: File existsmkdir:cannot create directory ‘/lidao’: File exists
mkdir: cannot create directory ‘/lidao’: File exists
無(wú)法? 創(chuàng)建? ? 目錄? 因?yàn)檫@個(gè)目錄已經(jīng)存在
2. No such file or directory 沒(méi)有這個(gè)文件或目錄(這個(gè)東西不存在)
沒(méi)有這個(gè)目錄:文件或路徑書(shū)寫(xiě)錯(cuò)誤
[root@oldboyedu59 ~]# mkdir? /oldboy[root@oldboyedu59 ~]# cd oldboy-bash:cd:oldboy:No such fileordirectory
mkdir命令本身問(wèn)題:mkdir 命令默認(rèn)只能創(chuàng)建1層目錄 創(chuàng)建多層報(bào)錯(cuò)
-p解決
[root@oldboyedu59 ~]# mkdir? /data/oldboy/lidao/mkdir:cannot create directory ‘/data/oldboy/lidao/’: No such fileordirectory
touch命令只能創(chuàng)建文件,目錄不存在則會(huì)報(bào)錯(cuò)
解決:先創(chuàng)建目錄,再創(chuàng)建文件
[root@oldboyedu59 ~]# ls /oldboy/oldboy.txt[root@oldboyedu59 ~]# touch /oldboy/lidao/alex/oldboy.txttouch:cannot touch ‘/oldboy/lidao/alex/oldboy.txt’: No such fileordirectory
排錯(cuò)思路:
1.ls命令檢查對(duì)應(yīng)的目錄是否存在?
2.目錄不存在 先創(chuàng)建目錄在創(chuàng)建文件/
3. command not found 命令找不到(沒(méi)有這個(gè)命令)
[root@oldboyedu59 ~]# mkdiy-bash:mkdiy:commandnotfound
1.書(shū)寫(xiě)錯(cuò)誤
2.沒(méi)有安裝
4. invalid option? 無(wú)效的參數(shù)(不可用的參數(shù))
[root@oldboyedu59 ~]# touch -p /oldboy/oldboy.txttouch: invalid option --'p'Try'touch --help'formore information.
5. overwrite? 覆蓋
cp復(fù)制如果已經(jīng)存在這個(gè)文件會(huì)提示是否覆蓋
[root@oldboyedu59 ~]# cp? /oldboy/oldboy.txt? /tmp/cp:overwrite ‘/tmp/oldboy.txt’?
6.remove regular empty file 是否刪除普通文件(空的)?
[root@oldboyedu59 ~]# rm? /oldboy/oldboy.txtrm: remove regularemptyfile ‘/oldboy/oldboy.txt’?
7. is a directory xxx是一個(gè)目錄
rm默認(rèn)無(wú)法刪除目錄
解決:加上-r 或-rf
[root@oldboyedu59 ~]# rm /data/rm:cannot remove ‘/data/’: Is a directory
vi命令中 使用vi編輯目錄也會(huì)報(bào)錯(cuò)
"/oldboy"E502:"/oldboy"is a directoryPress ENTER ortypecommandtocontinue
8. descend into directory 是否進(jìn)入目錄
[root@oldboyedu59 ~]# rm -r /data/rm: descend into directory ‘/data/’? yrm: remove regularemptyfile ‘/data/oldboy01.txt’? nrm: remove regularemptyfile ‘/data/oldboy02.txt’? nrm: remove regularemptyfile ‘/data/oldboy03.txt’? nrm: remove regularemptyfile ‘/data/oldboy04.txt’? nrm: remove regularemptyfile ‘/data/oldboy05.txt’? nrm: remove regularemptyfile ‘/data/oldboy06.txt’? nrm: remove regularemptyfile ‘/data/oldboy07.txt’? nrm: remove regularemptyfile ‘/data/oldboy08.txt’? nrm: remove regularemptyfile ‘/data/oldboy09.txt’? nrm: remove regularemptyfile ‘/data/oldboy10.txt’? nrm: remove directory ‘/data/’? n
9. Invalid level 無(wú)效的層數(shù),層數(shù)必須大于0
注意參數(shù)位置
[root@oldboyedu59 ~]# tree? -L -F 2 / tree:Invalid level, must be greater than0.
10.? Can't open file for writing 無(wú)法打開(kāi)這個(gè)文件
vi中 如果目錄不存在就會(huì)提示
"/oldbyo/oldboy.txt""/oldbyo/oldboy.txt"E212: Can't open fileforwritingPress ENTERortype command tocontinue
11.No write since last change
E37:No write since last change (add ! to override)? ? 粘包賴(你修改了內(nèi)容就無(wú)法使用:q退出 需要使用