Home  >  Article  >  Operation and Maintenance  >  How to solve the problem that all commands cannot be used in Linux

How to solve the problem that all commands cannot be used in Linux

WBOY
WBOYOriginal
2022-05-23 17:36:188561browse

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.

How to solve the problem that all commands cannot be used in Linux

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How to solve the problem that all commands cannot be used in Linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn