Running scripts in your shell without specifying the absolute path

March 26, 2019

If you want to run a script (or any executable file) in your shell you have to specify the absolute path to it. This might not always be a desired way of doing it, especially if you often use the script or if you want to call it from a launcher like Rofi or dmenu.

To make things simpler you can add a $PATH to your shell. You can then call the script just by it’s name without the path to it. Like instead of ~/Scripts/


Add this to your configuration file (~/.zshrc for zsh and ~/.bashrc for Bash):

export PATH="<your path>:$PATH"

You can use any folder. I prefer having my scripts in the folder ~/Scripts:

export PATH="$HOME/Scripts:$PATH"

Resource your configuration file (or just restart the terminal emulator):


$ source ~/.bashrc


$ source ~/.zshrc

You can now call your script only by its name if it’s stored in ~/Scripts or whatever folder you specified.


No Comments

Use the e-mail form, if you wish to leave feedback for this post. Markdown is supported. [Terms of service]