[root@oldboyedu59 ~]# mkdir /data /lidao [root@oldboyedu59 ~]# mkdir /data /lidao mkdir: cannot create directory ‘/data’: File exists mkdir: cannot create directory ‘/lidao’: File exists
mkdir: cannot create directory ‘/lidao’: File exists
沒法 建立 目錄 由於這個目錄已經存在shell
沒有這個目錄:文件或路徑書寫錯誤vim
[root@oldboyedu59 ~]# mkdir /oldboy [root@oldboyedu59 ~]# cd oldboy -bash: cd: oldboy: No such file or directory
mkdir命令自己問題:mkdir 命令默認只能建立1層目錄 建立多層報錯
-p解決centos
[root@oldboyedu59 ~]# mkdir /data/oldboy/lidao/ mkdir: cannot create directory ‘/data/oldboy/lidao/’: No such file or directory
touch命令只能建立文件,目錄不存在則會報錯
解決:先建立目錄,再建立文件bash
[root@oldboyedu59 ~]# ls /oldboy/ oldboy.txt [root@oldboyedu59 ~]# touch /oldboy/lidao/alex/oldboy.txt touch: cannot touch ‘/oldboy/lidao/alex/oldboy.txt’: No such file or directory
排錯思路:服務器
一、ls命令檢查對應的目錄是否存在?網絡
二、目錄不存在 先建立目錄在建立文件/curl
[root@oldboyedu59 ~]# mkdiy -bash: mkdiy: command not found
1.書寫錯誤
2.沒有安裝ide
[root@oldboyedu59 ~]# touch -p /oldboy/oldboy.txt touch: invalid option -- 'p' Try 'touch --help' for more information.
cp複製若是已經存在這個文件會提示是否覆蓋測試
[root@oldboyedu59 ~]# cp /oldboy/oldboy.txt /tmp/ cp: overwrite ‘/tmp/oldboy.txt’?
[root@oldboyedu59 ~]# rm /oldboy/oldboy.txt rm: remove regular empty file ‘/oldboy/oldboy.txt’?
rm默認沒法刪除目錄
解決:加上-r 或-rfurl
[root@oldboyedu59 ~]# rm /data/ rm: cannot remove ‘/data/’: Is a directory
vi命令中 使用vi編輯目錄也會報錯
"/oldboy" E502: "/oldboy" is a directory Press ENTER or type command to continue
[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/’? n 1.9 Invalid level 無效的層數,層數必須大於0
注意參數位置
[root@oldboyedu59 ~]# tree -L -F 2 / tree: Invalid level, must be greater than 0.
vi中 若是目錄不存在就會提示
"/oldbyo/oldboy.txt" "/oldbyo/oldboy.txt" E212: Can't open file for writing Press ENTER or type command to continue
E37: No write since last change (add ! to override) 粘包賴(你修改了內容就沒法使用:q退出 須要使用:q!
這是w的坑 空間過小施展不開.
[root@oldboyedu60-lnb ~]# w w: 39 column window is too narrow
使用Xshell遠程鏈接失敗提示,檢查端口是否開啓或正確
[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.4 Protocol 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:\~]$
Could not resolve host沒法解析主機
主要是系統可否上網和DNS問題.
http://mirrors.tuna.tsinghua.edu.cn/centos/7.6.1810/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.tuna.tsinghua.edu.cn; Unknown error" Trying other mirror.
有兩種狀況:
狀況1:軟件已經安裝而且最新以下:
Package tree-1.6.0-10.el7.x86_64 already installed and latest version tree軟件包已經安裝而且是最新版本 Package 2:vim-enhanced-7.4.160-5.el7.x86_64 already installed and latest version Package 1:bash-completion-2.1-6.el7.noarch already installed and latest version Nothing to do
狀況2:軟件名字寫錯或沒有配置yum源致使找不到這個軟件包
[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 do
緣由:
1:DNS配置錯誤緣由
2:Linux沒法上網緣由
[root@oldboyedu59 ~]# ping baidu.com ping: baidu.com: Name or service not known 域名沒法識別(沒法將域名---->ip地址)
[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.
查看詳細錯誤緣由
·journalctl -xe·
Apr 01 15:31:05 oldboyusd.1 network[7816]: Bringing up interface etho: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device does not seem to be present, delaying initialization. Apr 01 15:31:05 oldboyusd.1 /etc/sysconfig/network-scripts/ifup-eth[8019]: Device does not seem to be present, delaying initializatio
[root@oldboyedu59 ~]# hostname oldboyedu59 [root@oldboyedu59 ~]# hostname oldboyedu59-lnb
vim /etc/hostname oldboyedu59-lnb
[root@oldboyedu59 ~]# hostname oldboyedu59-lnb [root@oldboyedu59 ~]# cat /etc/hostname oldboyedu59-lnb
解決:從新登陸下便可(斷開鏈接,從新鏈接)
[root@oldboyedu59-lnb ~]#