Path settings are broken when Linux is restarted

Asked 2 years ago, Updated 2 years ago, 142 views

Hello, everyone I installed Linux this time and put several analysis tools on top of it.

In order to run various tools comfortably, we set the path using the export syntax. When I set it up, the method I used is as follows.

-Login with root privileges

# export PATH=$PATH:/tools/installed/location

# source ~/.bashrc

The problem is that all of these settings are released when you log out and reconnect.

So the way I thought about it is to put each tool in the export phrase.Write a shell script to source in bashrc and put it in a place like /etc/rc.d5.

Or I'm thinking about linking the /tools / installed / location / to the bin folder... Which method works better?

Or is there a better way?

export path ubuntu

2022-09-21 14:53

1 Answers

If Linux uses shell BASH.

of the home directory of the account you are accessing.You can add the following to the end of the bashrc or .bash_profile file:

// ...
// Add to end of file
export PATH=$PATH:/New/Route/Additional

If you want all accounts that use BASH to have the same PATH path:

For CENTOS

Common to all Linux

You can modify the /etc/bashrc file. (Not a very recommended method, but you can make sure that all accounts have the same settings.)


2022-09-21 14:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.