關注【老男孩Linux運維】離大牛更近一步
一. 檔案和目錄類
1.1 File exist 檔案已經存在
[[email protected] ~]# mkdir /data /lidao
[[email protected] ~]# mkdir /data /lidao
mkdir: cannot create directory ‘/data’: File exists
mkdir: cannot create directory ‘/lidao’: File exists
mkdir: cannot create directory ‘/lidao’: File exists
無法 建立 目錄 因為這個目錄已經存在
1.2 No such file or directory 沒有這個檔案或目錄(這個東西不存在)
沒有這個目錄:檔案或路徑書寫錯誤
[[email protected] ~]# mkdir /oldboy
[[email protected] ~]# cd oldboy
-bash: cd: oldboy: No such file or directory
mkdir指令本身問題:mkdir 指令預設隻能建立1層目錄 建立多層報錯
-p解決
[[email protected] ~]# mkdir /data/oldboy/lidao/
mkdir: cannot create directory ‘/data/oldboy/lidao/’: No such file or directory
touch指令隻能建立檔案,目錄不存在則會報錯
解決:先建立目錄,再建立檔案
[[email protected] ~]# ls /oldboy/
oldboy.txt
[[email protected] ~]# touch /oldboy/lidao/alex/oldboy.txt
touch: cannot touch ‘/oldboy/lidao/alex/oldboy.txt’: No such file or directory
排錯思路:
1、ls指令檢查對應的目錄是否存在?
2、目錄不存在 先建立目錄在建立檔案/
1.3 command not found 指令找不到(沒有這個指令)
[[email protected] ~]# mkdiy
-bash: mkdiy: command not found
1.書寫錯誤
2.沒有安裝
1.4 invalid option 無效的參數(不可用的參數)
[[email protected] ~]# touch -p /oldboy/oldboy.txt
touch: invalid option -- 'p'Try 'touch --help' for more information.
1.5 overwrite 覆寫
cp複制如果已經存在這個檔案會提示是否覆寫
[[email protected] ~]# cp /oldboy/oldboy.txt /tmp/
cp: overwrite ‘/tmp/oldboy.txt’?
1.6 remove regular empty file 是否删除普通檔案(空的)?
[[email protected] ~]# rm /oldboy/oldboy.txt
rm: remove regular empty file ‘/oldboy/oldboy.txt’?
1.7 is a directory xxx是一個目錄
rm預設無法删除目錄
解決:加上-r 或-rf
[[email protected] ~]# rm /data/
rm: cannot remove ‘/data/’: Is a directory
vi指令中 使用vi編輯目錄也會報錯
"/oldboy"
E502: "/oldboy" is a directory
Press ENTER or type command to continue
1.8 descend into directory 是否進入目錄
[[email protected] ~]# 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
注意參數位置
[[email protected] ~]# tree -L -F 2 /
tree: Invalid level, must be greater than 0.
1.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 continue
1.11 No write since last change
E37: No write since last change (add ! to override)
粘包賴(你修改了内容就無法使用:q退出 需要使用:q!
1.12 xx column window is too narrow 視窗隻有xx列太窄了 無法完全顯示
這是w的坑 空間太小施展不開.
[[email protected] ~]# w
w: 39 column window is too narrow
二. 網絡連接配接類
2.1 遠端連接配接錯誤 Connection Failed 連接配接失敗
使用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:\~]$
2.2 yum安裝軟體故障提示 Could not resolve host無法解析主機
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.
2.3 yum安裝軟體提示:Nothing to do (沒事做)
有兩種情況:
情況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源導緻找不到這個軟體包
[[email protected] ~]# 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.cnbase | 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
2.4 Name or service not known 域名無法識别(無法上網)
原因:
1:DNS配置錯誤原因
2:Linux無法上網原因
[[email protected] ~]# ping baidu.com
ping: baidu.com: Name or service not known
域名無法識别(無法将域名---->ip位址)
三. 修改系統基礎配置類
3.1 重新開機網卡報錯 device not present
[[email protected] ~]# 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
3.2 修改主機名過程中,指令行中主機名沒有變化
1# hostname指令修改主機名(臨時 重新開機伺服器之後失效)
[[email protected] ~]# hostname
oldboyedu59
[[email protected] ~]# hostname oldboyedu59-lnb
2# 修改檔案内容(寫合同 永久 重新開機伺服器之後生效)
vim /etc/hostname
oldboyedu59-lnb
3# 檢查
[[email protected] ~]# hostname
oldboyedu59-lnb
[[email protected] ~]# cat /etc/hostname
oldboyedu59-lnb
指令行中的主機名部分沒有改變?
解決:重新登入下即可(斷開連接配接,重新連接配接)
[[email protected] ~]#
Linux | 一分鐘·小百科
看視訊,聽李導講:
04 某直播平台将關閉伺服器?那麼什麼是伺服器呢?

主講人:李導
老男孩IT教育·總監講師;江湖人稱:悠久之翼;
Linux一線實戰經驗及Linux教學經驗,擅長以圖形表達講解抽象概念,善于用簡單易懂的例子講解重點難點,嚴肅不失幽默,著有《跟老男孩學Linux三劍客》一書
咨詢Linux雲計算運維&網絡安全課程,請點選本文左下角“閱讀原文”~
重
磅
消
息
老男孩教育作為率先開展Linux和Python教育訓練的領跑者,
Linux雲計算&&安全運維工程師2019重磅更新,持續領跑高端IT教育:課程更新7大亮點:
1、增加Python自動化CMDB平台實戰項目(約4-10天);
2、增加大量網絡安全課程(約10-20天);
3、增加阿裡雲企業級雲服務實戰環境項目實踐(約2-4天);
4、增加個人成長、職場高薪、成為管理者職場思想課(約10-20天);
5、增加Docker、K8S企業級實戰實戰項目(約5-10天);
6、增加ELK日志收集項目實戰(約2天);
7、全程提供教學教材、習題、考試,學生人手多本;
将Linux運維工程師、網絡安全工程師、雲計算工程師、運維開發、進階架構師、資料庫管理者全運維類技術崗位一網打盡。
- MongoDB入門篇 · 資料庫管理系統和NoSQL
- MongoDB學習篇:MongoDB是什麼?
- MongoDB學習篇:MongoDB的部署和基本操作
- MySQL的體系結構和基本管理是怎麼樣的?
- Linux雲計算 | Kubernetes編排系統
- sersync如何實作資料實時同步?
- Linux幹貨 | 強大的Linux日志分析系統AWStats
- 做運維需要了解哪些Redis資料庫知識?(下)
- 内附視訊丨聽老男孩談:大齡IT工程師的出路在哪裡?
老男孩IT教育【Linux雲計算運維&網絡安全】課程,開設有全日制脫産班、周末班和網絡線上班,以幫助更多有需要的盆友們提升技能,若是想要了解具體課程内容的話,那就點選本文左下方“閱讀原文”吧~
看完本文有收獲?那就分享給更多朋友吧~
長按下方二維碼,關注我喲
我知道你【在看】