The other day I created a bash script to optimize my Sapporo Ganso Ramen Alley documentary images for the web. But, after a while a noticed my script was not in my PATH. So, I could not execute it by just typing it. I needed to find where to place bash scripts in my Debian 13 machine. It has been a while since I used Linux for my day to day work. I abandoned MacOS to see how it feels. So far, it has been going great using Linux only. I am learning a lot, which makes me feel more confident about taking the LPIC 102 certification soon.

Place bash scripts in my $PATH in Debian 13

This is how I did it. To use the script just for your user-Stored them in your home directory:

~/.local/bin/ or ~/bin/

Keeps your scripts completely isolated from other users and doesn’t require root (sudo) permissions to manage.

If ~/.local/bin or ~/bin/ are missing just create them. Debian 13 is supposed to pick up the above directory and added it to your $PATH. That did not happen for me. So, I found out to add bash scripts to my $PATH I had to do:

export PATH="$HOME/.local/bin:$PATH"

To make it permanent, edit your ~/.bashrc file and add the below code to the end of the file:

# Add local bin to PATH if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Save and close the file. Finally, to apply the changes right away do:

source ~/.bashrc

To verify run again:

echo $PATH

You should see /home/yourusername/.local/bin in your $PATH now. That’s all! Contact me if you have any questions.

Consider grabbing of my designs below!

Leave a comment

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