Adding a (hidden) folder to your Linux $PATH

Create a hidden .bin folder somewhere you like. I did it on my home folder:

mkdir ~/.bin

You can add this folder to your $PATH by adding to .bashrc:

## Path
export PATH=$PATH:/home/dth/.bin

Now let’s test by adding a bash script I wrote called qdb (creates SQL DB, user and pwd)

cd ~/.bin && wget https://raw.githubusercontent.com/xdth/qdb/master/qdb


Finally, set the file as executable

chmod +x qdb

Move to another directory (e.g. cd /) and try to load the script inside the .bin folder

qdb --help

You shall see the help screen of the script. Now all other executables you add to ~/.bin will be available everywhere on your session.

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading Facebook Comments ...
Loading Disqus Comments ...