FreeKB - Linux Fundamentals $PATH variable
Linux Fundamentals - $PATH variable

$PATH is a default Linux variable that contains directories to commands. echo or printf can be used to display the current directories in the $PATH variable.

echo $PATH

 

Which should return something like this.

/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

 

Directories can temporarily be appended to the PATH variable like this.

export PATH=$PATH:/opt/foo:/usr/bar

 

Better yet, PATH can be defined in your /home/username/.bash_profile file, so that every time you sign into the system, your PATH will contain the directories defined in your .bash_profile file.

PATH=$PATH:/home/john.doe/.local/bin:/home/john.doe/bin
export PATH

 

You would then want to log out of the system, log back in, and echo or printf should now contain the additional directories.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter e82a6 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |