In linux, after an error occurs in modifying the profile file, all commands cannot be used. How can this problem be solved ?, Linuxprofile
Scenario
Today, we installed linux for the second time, and there were more new ones.
I was supposed to configure the java environment variable in/etc/profile. I got it wrong: enter it as;, and then all the commands except cd went wrong.
You cannot log on to the system after restarting.
Therefore, we tried two solutions.
Method 1
This is the first time that I have been unable to log on to the system. I thought I was about to reload the system. I thought it was definitely the profile error, so I thought it would be nice to change it back in the recovery mode.
Enter the recovery mode to enter the root account. Of course, if your password is forgotten, you can use the passwd command to modify the password. In this case, you will find that all files are read-only even though they are root users, in addition, vi is not easy to use in the root, enter the command: mount-o remount, rw/assign the read and write permissions to all files in the/directory to modify the file with an error, that is, the/etc/profile file, and then reboot
Method 2
At first, I thought it was an error when I configured the environment. Then I tried it again, and then I couldn't enter it. At this time, I didn't feel like I was thinking about the usage. I thought it would be more convenient.
Run the following command: export PATH =/usr/bin:/usr/sbin:/bin:/sbin, reconfigure the PATH environment variable and change/etc/profile back to source/etc/profile.