I want to add multiple path in $path variable like java path and php path . how to do that in linux?
I am doing something in bash_profile like :
PATH=$JAVA_HOME/bin:$PATH:/usr/java/jdk1.7.0_45/bin/:$AWS_AUTO_SCALING_HOME/bin
$PATH can have several paths separated by a colon (:). E.g.:
export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/myuser/bin
export PATH="$PATH~/something"Set the $PATH environment variable to include the directory where you installed the bin directory with shell scripts and two consecutive export entries as in example.
Example:
export ANT_HOME=/path/to/ant/dir
export PATH=${PATH}:${ANT_HOME}/bin:${JAVA_HOME}/bin
To make them permanent entries update the bash_profile file.
One way to add multiple executables to the $PATH variable is:
export PATH=/path/to/executable1:\
/path/to/executable2:\
/path/to/executable3:\
/path/to/executable4
If a $PATH already exists in .bash_profile, and you want them to take precedence over executables (like java and php), you can do:
export PATH=$PATH:/path/to/executable1:\
/path/to/executable2:\
/path/to/executable3:\
/path/to/executable4
If the path to any executable contains whitespaces, add the part / ... executableX in quotes.
Once you're done making changes in your bash_profile, source the file in a terminal session so that changes are effective immediately:
source .bash_profile
If you're on a Mac, the best way in my opinion would be following Chamindu's answer with a slight tweak. using nano or vim whichever you prefer, but I'll use nano as it's easier for most people.
nano ~/.bash_profile to open bash profile.FLUTTER="/Users/MyUsername/development/flutter/bin"VSCODE="/Applications/Visual Studio Code.app/Contents/Resources/app/bin"PATH=$PATH:$FLUTTER:$VSCODEexport PATHcontrol + x on your keyboard to exit.Y to save your changes.source ~/.bash_profile to refresh your bash profile/environment variables.Now you can navigate to any directory and call the files in your path.
Note:
FLUTTER and VSCODE for your variable names of choice.sudo if you're not using the admin account.\ after :sudo CPATH=/usr/include/linux/:/usr/src/linux-headers-5.17.0-1-common/include/linux/ vmware-modconfig --console --install-all
PATH="...".PATH="$JAVA_HOME/bin:$PATH:/usr/java/jdk1.7.0_45/bin/:$AWS_AUTO_SCALING_HOME/bin". It's just a guess.$PATH, you seem to setup correctly.