Linux, plaintext & minimalism
March 26, 2019

Running scripts in your shell without specifying the absolute path

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 example.sh instead of ~/Scripts/example.sh.


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.

Tags: Bash | Zsh | Shell


I don't have a commenting system simply because I haven't found a solution that I like. If you want to leave any feedback and/or have any questions feel free to contact me either via e-mail, the fediverse, by XMPP or by IRC (I'm Hund at freenode.net).