After executing source ~/.zshrc in the command line, you can only use the cd command. Other ls, vim... cannot be used, and the error zsh: command not found: ls will be reported. How to solve this?
人生最曼妙的风景,竟是内心的淡定与从容!
Your PATH must be misconfigured somewhere. Post the relevant lines in .zshrc that configure PATH
Check whether your zsh is installed and see if there is a .zshrc file in the path
Check the $PATH variable
$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
For example, the directory where ls is located:
$ whereis ls /bin/ls
If it does not exist in $PATH/bin/, the ls command will not be recognized.
/bin/
Put a copy of the path in your default bash into zsh as well
cat .zshrc vim .zshrc 增加: export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
The person above is right, there is a problem with PATH. .zshrc generally adds directories to PATH:
export PATH=$PATH:$YOUR_FOLDER/bin
If you accidentally write:
export PATH=$YOUR_FOLDER/bin
The situation you mentioned will occur.
Your PATH must be misconfigured somewhere. Post the relevant lines in .zshrc that configure PATH
Check whether your zsh is installed and see if there is a .zshrc file in the path
Check the $PATH variable
For example, the directory where ls is located:
If it does not exist in $PATH
/bin/
, the ls command will not be recognized.Put a copy of the path in your default bash into zsh as well
The person above is right, there is a problem with PATH.
.zshrc generally adds directories to PATH:
If you accidentally write:
The situation you mentioned will occur.