Set a custom path - Parthaaaaa/practicelinux GitHub Wiki

  • open .profile or ~/.profile or ~/.bash_profile or ~/.bashrc file inside vim

  • add this following line bottom of the file and save:

    export path=$path:/yourPath;

  • run following command: source ~/.bash_profile or your edited file

  • check your newly added path by:

    echo $PATH

Another method:(Global)

Add a file with the value you want the PATH to have in /etc/profile.d. These files are setup to be sourced by shells such as Bash, Csh Zsh, or tcsh.

Example:

If you needed to have the following value added to your PATH:

/usr/local/share/bin

then,you have to create a file, /etc/profile.d/afilename.sh,with the following line in it:

export PATH=/usr/local/share/bin:$PATH

Files with the extension .sh are sourced by shells such as Bash and Zsh. Files with the extension .csh are sourced by Csh and tcsh