The method of modifying the /etc/profile file in Linux system

  

In the Linux system, the etc/profile file can't be changed. To change the etc/profile file, you need to use some special techniques to modify the Linux file. This article will introduce Linux system to modify /etc /profile file method:

etc /profile file is read-only, the direct use vi or gedit open the modifications are not saved. To modify the profile, you need to get root privileges (edit with gedit)

$sudo gedit /etc/profile

or

$sudo -s

$gedit /etc/profile

This opens the profile file and can be saved after modification.

How to make the modified profile file take effect immediately:

Method 1:

$. /etc/profile

. There is a space between /etc/profile

Method 2:

$source /etc/profile

The source command is also called “point command”, also Is a dot symbol (.). The source command is usually used to re-execute the newly modified initialization file so that it can take effect immediately without having to log out and log back in.

The above is the way to modify the /etc/profile file in the Linux system. As long as you get the administrator rights, even if the etc/profile file is a system file, you can modify it.

Copyright © Windows knowledge All Rights Reserved