問題來源
重啟Ubuntu后習(xí)慣性的執(zhí)行ifconfig
報錯如下
Command 'ifconfig' is available in '/sbin/ifconfig'
The command could not be located because '/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
ifconfig: command not found
分析原因
應(yīng)該是/sbin這個文件夾莫名其妙的從環(huán)境變量里消失了
解決方式
所以我們可以先查查看我們的環(huán)境變量:
a@ubuntu ~> echo $PATH
/home/a/.local/bin /usr/local/bin /usr/bin /bin /usr/games /snap/bin
居然不見「/sbin」,
所以我們得將「/sbin」加入至環(huán)境變數(shù)之中:
a@ubuntu ~> export PATH=$PATH:/sbin
再次查看環(huán)境變量:
a@ubuntu ~> echo $PATH
/snap/bin /sbin
這么一來以后就可以使用 /sbin 目錄下的指令了
問題
為什么我把/sbin加入環(huán)境變量后
再次輸出環(huán)境變量 環(huán)境變量就變少了呢?