Making Variables Persistent
I probably want my new PATH variable value assignment to be automatically made each time the system restarts. I don’t want to have to manually set the value of PATH and export it each time the system reboots.To do this, I can use the command to set the value of PATH to include /var/opt/mydb as well as the command to export the PATH variable to one of the following bash configuration files:
~/.bashrc
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
Adding the commands to a global bash configuration file such as /etc/profile will cause the change to be applied to all users. If you want to apply the change to only a single user, you should use the appropriate bash configuration file found in that user’s home directory.
You need to determine which files your particular distribution uses. For example, you could modify the following commands in the ~/.bash_profile file in the ksanders user’s home directory:
PATH=$PATH:$HOME/bin:/var/opt/mydb
export PATH
LX0-104 Exam Objectives (E)
Showing posts with label PATH. Show all posts
Showing posts with label PATH. Show all posts
Wednesday, December 7, 2016
PATH environment variable
PATH environment variable
Linux does not check the current directory. This can be very confusing to new Linux administrators and users. They expect to be able to switch to the directory where an executable resides and run it from the command line.Under Linux, this doesn’t work. Instead, Linux only searches for the file being run within the directories in the current user’s PATH variable.
A typical Linux PATH environment variable is shown in this example:
rtracy@openSUSE:~> echo $PATH
/usr/lib/mpi/gcc/openmpi/bin:/home/rtracy/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games
LX0-104 Exam Objectives (D)
Linux does not check the current directory. This can be very confusing to new Linux administrators and users. They expect to be able to switch to the directory where an executable resides and run it from the command line.Under Linux, this doesn’t work. Instead, Linux only searches for the file being run within the directories in the current user’s PATH variable.
A typical Linux PATH environment variable is shown in this example:
rtracy@openSUSE:~> echo $PATH
/usr/lib/mpi/gcc/openmpi/bin:/home/rtracy/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games
LX0-104 Exam Objectives (D)
Subscribe to:
Posts (Atom)