Lin @ lenovo :~ $ Su-root Password: Command 'mesg' isavailablein '/usr/bin/mesg' Thecommandcouldnotbelocatedbecause'/usr/bin' failed.-su: mesg: Command root @ lenov not found
Lin @ lenovo :~ $ Su-root
Password:
Command 'mesg' is available in '/usr/bin/mesg'
The command cocould not be located because '/usr/bin' is not supported ded in the PATH environment variable.
-Su: mesg: Command not found
Root @ lenovo :~ # Gedit/etc/profile
Command 'gedit 'is available in'/usr/bin/gedit'
The command cocould not be located because '/usr/bin' is not supported ded in the PATH environment variable.
-Su: gedit: Command not found
Root @ lenovo :~ # Useradd yul
Command 'useradd' is available in'/usr/sbin/useradd'
The command cocould not be located because '/usr/sbin' is not supported in the PATH environment variable.
This is most likely caused by the lack of administrative priviledges associated with your user account.
-Su: useradd: The command cannot be found.
Root @ lenovo :~ # Vi
Command 'vi' is available in '/usr/bin/vi'
The command cocould not be located because '/usr/bin' is not supported ded in the PATH environment variable.
-Su: vi: Command not found
Problem Analysis and Solution:
This is mainly about the PATH. First, check the setting of the $ PATH variable.
Echo $ PATH
The format is xxx: xxx
This should not contain the path/usr/bin.
Run the following command to include the path:
Export PATH =/usr/bin/: $ PATH
If you want to automatically include this path every time you log on to the system,
You can add this command to the end of the/root/. bash_profile or/root/. bashrc file.
The details are as follows:
Return to normal user (my normal user is lin)
Lin @ lenovo :~ $ Sudo gedit/root/. bash_profile
Add export PATH =/usr/bin/: $ PATH and save the close. bash_profile file.
Lin @ lenovo :~ $ Su-root
Password:
Root @ lenovo :~ # Echo $ PATH
/Usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Root @ lenovo :~ # Env
SHELL =/bin/bash
TERM = xterm
XDG_SESSION_COOKIE = f591adb565a6ba1bc40f9e954a26895b-1255053756.679619-1536901825
USER = root
MAIL =/var/mail/root
PATH =/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD =/root
LANG = zh_CN.UTF-8
SHLVL = 1
HOME =/root
LANGUAGE = zh_CN: zh
LOGNAME = root
_ =/Usr/bin/env
Root @ lenovo :~ # Vi
You can edit the vi.