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 > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces how to add the directory to $PATH in the Linux system, the content is very detailed, interested friends can refer to, hope to be helpful to you.
The old name PATH means the search path for the executable file of the device. When we type the command in the Linux system, the sehll program will search for the executable file of that name in all directories specified in the user's PATH` variable.
What is the $PATH in Linux? the $PATH environment variable is a colon-delimited list that tells which directories to search for executable files to executable files.
To check your directory $PATH, you can use the printenv or echo command:
Echo $PATHCopy
The output will look like this:
/ usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/binCopy
If you have two executables that share the same name in two different directories, Shell will run the files located in the first $PATH directory.
Add directories to your $PATH in some cases, you may need to add other directory $PATH variables. For example, some programs may be installed in a different location, or you may want to establish a dedicated directory for your personal notes, but you may be able to run them without specifying the absolute path to the executable. To do this, you just need to add the directory to $PATH.
Suppose you have a directory called bin in your home directory. To add a directory to your $PATH, enter:
Export PATH= "$HOME/bin:$PATH" Copy
The export command exports the modified variables to the shell child process environment.
Now you can simply type the executable script name to run the script without specifying the full path to the executable file.
However, this change is only temporary and is only valid in the current Shell session.
For the change to take effect permanently, you need to define the variable $PATH in the shell configuration file. In most Linux distributions, when you start a new session, the environment variables are read from the following files:
Configuration files specific to the global Shell, such as / etc/environment and / etc/profile. If you want to add a new directory to all system users, use the $PATH of this file.
Per user shell program specific configuration file. For example, if you are using Bash, you can set the variable $PATH in the ~ / .bashrc file, and if you are using Zsh, the file name is ~ / .zshrc.
In this example, we will set the variable in the ~ / .bashrc file. Open the file using a text editor and add the following line to the end of the file:
Nano / .bashrcCopy
~ / .bashrc
Export PATH= "$HOME/bin:$PATH" Copy
Save the file and $PATH loads the new file into the current shell session using the following source command:
Source / .bashrcCopy
To confirm that the directory has been successfully added, type $PATH, and the following command prints your value:
Echo $PATHCopy
Conclusion when you add a new directory to the $PATH variable, you can execute commands and scripts stored in a non-standard location without typing the full path to the executable.
What are the versions of Linux? the versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.
On how to add directories to $PATH in the Linux system to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.