How do you add something to the Path environmental variable?

Path environmental variables are variables that function like a shortcut for your system. They allow you to define directories where executables are located.

Assume you installed this application picc-9.82.9453-linux.run. Without setting the path you’d have to run this every time in your terminal:

# /usr/hitech/picc/9.82/bin/picc

Instead of:

# picc

Running picc without having to define the path every time is so much easier, and faster. To achieve this experience you have to add the application executable to the Path environmental variable.

The first option is edit your user profile:

$ vim ~/.bash_profile

It will look something like this:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

You are looking to edit this section:

PATH=$PATH:$HOME/bin

Update the path with new application location (e.g., /usr/hitech/picc/9.82/bin) using the colon (:) as the separator.

PATH="$HOME/bin:$PATH:/usr/hitech/picc/9.82/bin"

Save the file, and try running the command in your terminal.

# picc

Sharing is caring!

Leave a Reply