
最近幾天我遇到這個問題。每當我在 Ubuntu 16 中開啟終端時,第一行都會顯示「$:命令找不到」。
$: command not found
jitendra@jitendra-ubuntu:~ $
答案1
shell 的一個初始化檔包含一行有單一單獨的$
.由於它本身位於一行,因此它作為命令運行,並且由於不存在$
具有該名稱的命令,因此您會收到該錯誤。您需要找到並刪除該行。打開終端機並執行以下命令:
grep --color -PH '^\s*\$\s*$' ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login \
~/.bash_aliases /etc/bash.bashrc /etc/profile \
/etc/profile.d/* /etc/environment 2> /dev/null
這應該返回一行:
/home/jitendra/.bashrc:$
開啟報告的檔案名,找到該行並將其刪除。