Linux 中 command not found 解決辦法

來源:酷知科普網 2.99W

安裝好 Linux 系統後,其他一切正常,卻在終端無法執行某些命令(如 shutdown 等),螢幕顯示錯誤為 command not found。那麼,該如何解決這個問題呢?下面就來教大家解決問題的方法。

操作方法

(01)從圖形介面啟動 Linux 終端。

Linux 中 command not found 解決辦法

(02)在命令列輸入 su,回車。然後輸入 root 使用者密碼(注意,螢幕上不顯示),回車,登入 root 使用者。

Linux 中 command not found 解決辦法 第2張

(03)在命令列輸入 gedit /etc/profile,回車。這樣就打開了一個文字編輯器對 profile 檔案進行編輯。

Linux 中 command not found 解決辦法 第3張

(04)在檔案的最末一行,新增 PATH=$PATH:/sbin,然後儲存並關閉檔案。注意,務必記得儲存檔案。

Linux 中 command not found 解決辦法 第4張

(05)在命令列繼續輸入 source /etc/profile ,回車,使剛才更改後的配置檔案生效。注意,etc 前面的 / 不能少。

Linux 中 command not found 解決辦法 第5張

(06)現在,一切大功告成。馬上試著執行 shutdown -h now 關機命令,是不是沒有錯誤提示了?

Linux 中 command not found 解決辦法 第6張

特別提示

shutdown 關機命令必須要 root 使用者才能執行,普通使用者無法執行該命令。

熱門標籤