Method: 1. Enter "export PATH=/usr/local/sbin..." directly on the Linux command line page and import the environment variables; 2. Use the absolute command vi to open profile, the syntax is /bin/ vi /etc/profile" and add the environment variable address in the configuration file.
The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
This problem occurs because the system environment variables are not configured correctly. There are many reasons for this, such as system upgrades, such as improper operations. Solved There are two ways.
One: Enter the following directly on the Linux command line interface, and then press Enter (import environment variables and storage addresses of common shell commands):
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Second: If all commands in the system cannot be used, you can also use the absolute command vi to open profile
/bin/vi /etc/profile
Add the environment variable address to the system configuration file
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Extended knowledge:
What should I do if Linux does not support all commands? Solve the problem that all Linux commands cannot be used
This problem indicates that there is a problem with your /etc/profile configuration. Usually it is because there is a problem with the path configuration. Eliminate the errors in the added content, and then restart a new window to execute source /etc/profile to solve the problem.
When all commands cannot be used, vi will also be lost. Function.
At this time, you need to use the absolute path of the shell command to call the command.
# 编辑profile文件 /usr/bin/vim /etc/profile
Then execute it in a new window
source /etc/profile
Recommended learning:Linux video tutorial
The above is the detailed content of How to solve the problem that all commands cannot be used in Linux. For more information, please follow other related articles on the PHP Chinese website!