bash in Linux: ls: command not found... similar command is: 'lz'

background:

It is found that ls cannot be used, ll, vi, and vim cannot be used.

Enter the ll command

Prompt: bash: ls: command not found... Similar command is: 'lz' 

reason:

The environment variable PATH has been modified, and the modification just operated has affected PATH

Solution:

1. Execute the following command: currently effective

export PATH=/bin:/usr/bin:$PATH

This method can only temporarily modify the current path environment, and will continue to fail if reconnected after exiting.

success!

2. Directly find the path to save the file, modifying the environment variables in /etc/profile will take effect permanently

vi /etc/profile

(1) Press the keyboard i to switch the insert mode, and directly append the path path here,

 (2) After adding the path variable, press ESC on the keyboard to exit the editing mode, and enter: wq to save and exit.

export PATH=/bin:/usr/bin:$PATH

:wq

(3) Reload the path environment variable.

source /etc/profile

The path environment variable in the original Linux should be as follows by default:

echo $PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

 3. For specific explanations of environment variables, please refer to the records of the following article, which can answer all questions.

centos7 environment variable settings

-------------------------------------------------- ------No text below----------------------------------------- -------------

Note: For study only, record questions and reference, encourage each other!

Guess you like

Origin blog.csdn.net/qq_39715000/article/details/125023629