ITPub博客

首页 > Linux操作系统 > Linux操作系统 > SUSE Linux执行基本命令出现command-not-found

SUSE Linux执行基本命令出现command-not-found

原创 Linux操作系统 作者:dayong2015 时间:2015-05-31 21:02:04 0 删除 编辑
今天远程登录到系统上后,执行su、ls等命令出现如下错误提示:
hana:~ # su - hdbadm
If 'su' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found su
-bash: su: command not found
hana:~ # ls
If 'ls' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found ls
-bash: ls: command not found
奇了怪了,昨天还好好的,今天怎么突然出现这个问题,有意思,哈哈。
查找相关资料后,说是环境变量的问题,操作如下:
先用whereis或者which命令查看一下有没有这个命令具体执行
hana:~ # whereis ls
If 'whereis' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found whereis
-bash: whereis: command not found
hana:~ # which ls
If 'which' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found which
-bash: which: command not found
查看当前系统的环境变量:
hana:~ # echo $PATH
/var/j2sdk1.4.2_19/bin
哪个小伙伴登录系统改我的环境变量了,让我有机会接触这个问题,当时配置好SAP HANA之后把相关信息发给了测试人员,先谢谢了哈。
尝试着重启了一把系统,结果输入正确的用户名和密码,服务器端也进不去了,越来越有意思了,如下:

但是远程依旧可以登录,还是你最可爱,看来只能远程登录了,既然是环境变量的问题,就修改呗,如下:
hana:~ # export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
hana:~ # ls
.ICEauthority  .exrc            .gvfs        .pulse                Desktop
.bash_history  .gconf           .hdb         .pulse-cookie         Documents
.bash_profile  .gconfd          .kbd         .skel                 autoinst.xml
.config        .gnome2          .local       .viminfo              bin
.dbus          .gnome2_private  .mailcap     .xsession-errors      inst-sys
.dmrc          .gnupg           .mime.types  .xsession-errors.old
.esd_auth      .gstreamer-0.10  .nautilus    51049354
hana:~ # su - hdbadm
hana:/usr/sap/HDB/HDB00>
以上设定只是对当前会话有效,下面把它加入到配置文件中,使其对所有会话有效
首先要找到为什么PATH=/var/j2sdk1.4.2_19/bin/java,存在于哪个配置文件中,然后将其注释掉,如下:
hana:~ # vi .bash_profile
hana:~ # source .bash_profile
hana:~ # cat .bash_profile
export JAVA_HOME=/var/j2sdk1.4.2_19/bin/java
#export PATH=/var/j2sdk1.4.2_19/bin            
其实PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin 是在用户家目录下隐藏文件.profile中指定的。

之后打开其他会话窗口就OK了,服务器端也能登录了,一系列连带问题都受那个环境变量配置的影响,可谓是牵一发而动全身,虚惊一场。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29634949/viewspace-1679768/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-04-29

  • 博文量
    78
  • 访问量
    790437