Basic Understanding of PATH in Linux

According to LINFO, PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files in response to commands issued by a user.

For example, when you want to use sed command, you can type sed instead of /bin/sed.

The PATH value is composed of several absolute paths that are separated by colons.  When the user issues a command that is not built in the shell or that is not an executable file’s absolute path, the shell searches through the absolute paths in PATH until it finds the corresponding executable file.

To view PATH:

# echo $PATH


You can add a directory to PATH for the current session using:

# PATH=”directory:$PATH”


To make the change permanent, edit .bash_profile file in the user’s home directory.

Find the line that starts with “PATH=” and add the directory:



then execute:

# . $HOME/.bash_profile


This entry was posted in Linux Admin Basics. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s