故障集合:那些年学习Linux坑你的故障集合
一. 文件和目錄類
1. File exist 文件已經(jīng)存在
[root@oldboyedu59?~]#?mkdir???/data???/lidao?? [root@oldboyedu59?~]#?mkdir???/data???/lidao?? mkdir:?cannot?create?directory?‘/data’:?File?exists mkdir:?cannot?create?directory?‘/lidao’:?File?existsmkdir: cannot create directory ‘/lidao’: File exists
無法 ? 創(chuàng)建 ? ?目錄 ? 因為這個目錄已經(jīng)存在
2. No such file or directory 沒有這個文件或目錄(這個東西不存在)
沒有這個目錄:文件或路徑書寫錯誤
[root@oldboyedu59?~]#?mkdir??/oldboy [root@oldboyedu59?~]#?cd?oldboy -bash:?cd:?oldboy:?No?such?file?or?directorymkdir命令本身問題:mkdir 命令默認(rèn)只能創(chuàng)建1層目錄 創(chuàng)建多層報錯
-p解決
touch命令只能創(chuàng)建文件,目錄不存在則會報錯
解決:先創(chuàng)建目錄,再創(chuàng)建文件
排錯思路:
1.ls命令檢查對應(yīng)的目錄是否存在?
2.目錄不存在 先創(chuàng)建目錄在創(chuàng)建文件/
3. command not found 命令找不到(沒有這個命令)
[root@oldboyedu59?~]#?mkdiy -bash:?mkdiy:?command?not?found1.書寫錯誤
2.沒有安裝
4. invalid option ? 無效的參數(shù)(不可用的參數(shù))
?[root@oldboyedu59?~]#?touch?-p?/oldboy/oldboy.txttouch:?invalid?option?--?'p'Try?'touch?--help'?for?more?information.5. overwrite ?覆蓋
cp復(fù)制如果已經(jīng)存在這個文件會提示是否覆蓋
[root@oldboyedu59?~]#?cp??/oldboy/oldboy.txt???/tmp/ cp:?overwrite?‘/tmp/oldboy.txt’?6.remove regular empty file 是否刪除普通文件(空的)?
[root@oldboyedu59?~]#?rm???/oldboy/oldboy.txt rm:?remove?regular?empty?file?‘/oldboy/oldboy.txt’?7. is a directory xxx是一個目錄
rm默認(rèn)無法刪除目錄
解決:加上-r 或-rf
vi命令中 使用vi編輯目錄也會報錯
"/oldboy"E502:?"/oldboy"?is?a?directory Press?ENTER?or?type?command?to?continue8. descend into directory 是否進入目錄
[root@oldboyedu59?~]#?rm?-r?/data/ rm:?descend?into?directory?‘/data/’??y rm:?remove?regular?empty?file?‘/data/oldboy01.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy02.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy03.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy04.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy05.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy06.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy07.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy08.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy09.txt’??n rm:?remove?regular?empty?file?‘/data/oldboy10.txt’??n rm:?remove?directory?‘/data/’??n9. Invalid level 無效的層數(shù),層數(shù)必須大于0
注意參數(shù)位置,數(shù)字需要加在-L后面
[root@oldboyedu59?~]#?tree??-L?-F?2?/? tree:?Invalid?level,?must?be?greater?than?0.10. ? Can't open file for writing 無法打開這個文件
vi中 如果目錄不存在就會提示
"/oldbyo/oldboy.txt" "/oldbyo/oldboy.txt"?E212:?Can't?open?file?for?writing Press?ENTER?or?type?command?to?continue11.No write since last change
E37:?No?write?since?last?change?(add?!?to?override)粘包賴(你修改了內(nèi)容就無法使用:q退出?需要使用:q!12. ?xx ?column window is too narrow ?窗口只有xx列太窄了 無法完全顯示
這是w的坑 空間太小施展不開.
[root@oldboyedu60-lnb?~]#?ww:?39?column?window?is?too?narrow二. 網(wǎng)絡(luò)連接類
1. 遠(yuǎn)程連接錯誤 Connection Failed 連接失敗
使用Xshell遠(yuǎn)程連接失敗提示,檢查端口是否開啟或正確
[c:\~]$?Connecting?to?10.0.0.200:233... Could?not?connect?to?'10.0.0.200'?(port?233):?Connection?failed.Type?`help'?to?learn?how?to?use?Xshell?prompt.使用telnet測試端口是否打開
[c:\~]$?telnet?10.0.0.200?233? Connecting?to?10.0.0.200:233... Could?not?connect?to?'10.0.0.200'?(port?233):?Connection?failed.???#233端口沒有開啟 Type?`help'?to?learn?how?to?use?Xshell?prompt.端口開啟
[c:\~]$?telnet?10.0.0.200?22 Connecting?to?10.0.0.200:22... Connection?established.????????????#端口開啟To?escape?to?local?shell,?press?'Ctrl+Alt+]'. SSH-2.0-OpenSSH_7.4Protocol?mismatch.Connection?closed?by?foreign?host.Disconnected?from?remote?host(10.0.0.200:22)?at?12:22:54.Type?`help'?to?learn?how?to?use?Xshell?prompt. [c:\~]$2. yum安裝軟件故障提示 Could not resolve host無法解析主機
Could not resolve host無法解析主機
主要是系統(tǒng)能否上網(wǎng)和DNS問題.
3.yum安裝軟件提示:Nothing to do (沒事做)
有兩種情況:
情況1:軟件已經(jīng)安裝并且最新如下:
情況2:軟件名字寫錯或沒有配置yum源導(dǎo)致找不到這個軟件包
[root@oldboyedu60-lnb?~]#?yum?install?treea?-y Loaded?plugins:?fastestmirror Loading?mirror?speeds?from?cached?hostfile*?base:?mirror.lzu.edu.cn*?extras:?mirrors.nwsuaf.edu.cn*?updates:?mirrors.nwsuaf.edu.cn base??????????????????????????????????????????????????????????????????????????????????????????????|?3.6?kB??00:00:00????? extras????????????????????????????????????????????????????????????????????????????????????????????|?3.4?kB??00:00:00?????updates???????????????????????????????????????????????????????????????????????????????????????????|?3.4?kB??00:00:00????? No?package?treea?available.? #沒有找到叫treea的軟件包 Error:?Nothing?to?do4. Name or service not known ?域名無法識別(無法上網(wǎng))
原因1:DNS配置錯誤
原因2:Linux無法上網(wǎng)原因 https://www.jianshu.com/p/0bc0b596c1a0
三. 修改系統(tǒng)基礎(chǔ)配置類
1. 重啟網(wǎng)卡報錯 device not present
[root@oldboyusd?~]#?systemctl?restart?network? Job?for?network.service?failed?because?the?control?process?exited?with?error?code.See?"systemctl?status?network.service"?and?"journalctl?-xe"?for?details.查看詳細(xì)錯誤原因
·journalctl -xe·
2. ?修改主機名過程中,命令行中主機名沒有變化
1# hostname命令修改主機名(臨時 重啟服務(wù)器之后失效)
[root@oldboyedu59?~]#?hostname oldboyedu59 [root@oldboyedu59?~]#?hostname?oldboyedu59-lnb2# 修改文件內(nèi)容(寫合同 ? ?永久 重啟服務(wù)器之后生效)
vim?/etc/hostname?oldboyedu59-lnb3# 檢查
[root@oldboyedu59?~]#?hostname oldboyedu59-lnb [root@oldboyedu59?~]#?cat?/etc/hostname? oldboyedu59-lnb命令行中的主機名部分沒有改變?
解決:重新登錄下即可(斷開連接,重新連接)
[root@oldboyedu59-lnb?~]#轉(zhuǎn)載于:https://blog.51cto.com/xiyuxingxia/2374972
總結(jié)
以上是生活随笔為你收集整理的故障集合:那些年学习Linux坑你的故障集合的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 三级菜单实例
- 下一篇: 开源是项“全民工程”,揭秘开源团队的管理