In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to modify the environment variable PATH path under the Linux system". In the daily operation, I believe that many people have doubts about how to modify the environment variable PATH path under the Linux system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use operation method. I hope it will be helpful to answer the doubt of "how to modify the environment variable PATH path under the Linux system". Next, please follow the editor to study!
The operating system is indispensable in the computer. And the development of Linux is very rapid, there is a trend to catch up with Microsoft. Here introduces the knowledge of Linux, so that you can learn to apply Linux system well. For example, to add the / etc/apache/bin directory to PATH, there are three ways:
1.#PATH=$PATH:/etc/apache/bin
Using this method, it is only valid for the current session, that is, every time you log out or log out of the system, the PATH setting becomes invalid.
2.#vi / etc/profile
Add PATH=$PATH:/etc/apache/bin at the appropriate location (note: = that is, there cannot be any spaces on either side of the equal sign)
This method is best, unless you manually force to change the value of PATH, otherwise it will not be changed
3.#vi / .bash_profile
Modify the PATH line to add / etc/apache/bin
This method works for users.
Note: if you want to change the PATH, you must log in again to take effect. The following methods can simplify the work:
If / etc/profile is modified, the value of the source profile or dot command. / profile,PATH will take effect immediately after editing.
The principle of this method is to execute the / etc/profile shell script again, note that it is not possible to use sh / etc/profile, because the sh is executed in the child shell process, even if the PATH changes will not be reflected in the current environment, but the source is executed in the current shell process, so we can see the PATH change.
In this way, you will learn how to modify the path of the environment variable PATH in the Linux system.
1. Under the Windows system, many software installations need to configure environment variables, such as installing jdk. If you do not configure environment variables and run the javac command in a directory that is not installed by software, you will report that the file cannot be found and similar errors will be reported.
2. So what are environmental variables? To put it simply, it is to specify a directory, and when you run the software, the relevant programs will look for relevant files according to that directory. The most useful function of setting variables for ordinary people is that you don't have to copy some dll files to the system directory, and the system variable path is a series of paths for the system to search for dll files.
On Linux, if you download and install an application, it is likely that the prompt "command not found" will appear when you type its name. If you go to the installation directory folder every time, it is too cumbersome to find executable files to operate. This involves the setting of the environment variable path, and the setting of Path is also a part of customizing the environment variable under Linux.
There are three ways to set environment variables under Linux:
To add a path to $PATH, you can do something like this:
1. Setting it in the console does not support this method, because it only works on the current shell, and changing the shell setting will have no effect:
$PATH= "$PATH": / NEW_PATH (closing shell Path will revert to the original path)
2, modify the / etc/profile file, if your computer is only used as a developer to use this method, because all users' shell has the right to use this environment variable, it may bring security problems to the system. This is for all users, all shell
Add: export PATH= "$PATH:/NEW_PATH" at the bottom of / etc/profile
3, modify the bashrc file, this method is more secure, it can control the use of these environment variables to the user level, here is for a specific user, if you need to give a user permission to use these environment variables, you only need to modify the individual user home directory under the .bashrc file on it.
Add below:
Export PATH= "$PATH:/NEW_PATH"
At this point, the study on "how to modify the PATH path of the environment variable under the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.