How should the environment variables be configured for the current user in Linux?

In Linux, you can configure the environment variables for the current user by following these steps:

  1. Open the terminal and log in to the user account where you want to set up the environment variables.
  2. Edit the environment variable configuration file of the current user. If you are using bash as your default shell, the environment variable configuration file is usually located at ~/.bashrc. You can open it with any text editor, such as vi or nano.
vi ~/.bashrc
  1. the directory where the executable files are stored is /usr/local/bin
export PATH=$PATH:/usr/local/bin
  1. Save and close the file.
  2. Apply the environment variable configurations. You can make the changes take effect by either reloading the bash configuration file or by closing and reopening the terminal.
source ~/.bashrc

You have successfully set up the environment variables for the current user. You can verify the settings of the environment variables by running the command echo $PATH.

广告
Closing in 10 seconds
bannerAds