配置完环境变量source之后,linux的ls vi命令均失效,报错如下:
解决方法
1.输入 export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin并进行source 来确保命令暂时使用
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin source
2.输入 vi ~/.bash_profile查看并修改环境
[root@son ~]# cat ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH JAVAHOME=/opt/bigdata/jdk180 export JAVAHOME PATH=$JAVAHOME/bin:$PATH export PATH
3.输入source ~/.bash_profile生效环境变量
4.此时可以通过vi /etc/profile再次配置环境变量,修改错误
export JAVAHOME=/opt/bigdata/jdk180 export PATH=$PATH:$JAVAHOME/bin:$PATH export CLASSPATH=.:$JAVAHOME/lib/dt.jar:$JAVAHOME/lib/tools.jar
5.重新source并java -version查看