Adding a Global Path in CentOS Linux
Step 1Open a terminal by clicking the “Applications” menu, pointing to “Accessories” and selecting “Terminal.”
Step 2Become the root
user by typing “su” into the terminal and pressing “Enter.” Type your
root password and press “Enter” when prompted.
Related Reading: What Is the Purpose of Sharing a Linux Printer Using Samba?
Step 3Type the
following command into the terminal, replacing “/new/directory” with the
path of the directory you want to add to your path, and press “Enter”:
echo 'pathmunge /new/directory' > /etc/profile.d/custompath.sh
echo 'pathmunge /new/directory' > /etc/profile.d/custompath.sh
Step 4Type the following command and press “Enter” to make your new file executable:
chmod +x /etc/profile.d/custompath.sh
chmod +x /etc/profile.d/custompath.sh
Step 5Type the
following command, including the period, and press “Enter” to reload
your profile settings and add the directory to your path:
. /etc/profile
. /etc/profile