PATH Command in Linux

Back

Directory Paths

There are two types of concepts you need to know when working with Linux directories. 
Absolute paths and Relative paths.

An absolute path describes the complete directory structure in terms of the top-level directory , root ( / ). A Relative path is based on the current directory and they do not include ( / ) in front.

The difference between the absolute and relative paths are important to understand while creating a script .
Otherwise , scripts executed  from the other directories may lead to unintended consequences .

Environment Paths

When running the command ,you should cite the full path to that command. 

For example :
since the ls command is in the  /bin directory ,users should actually run the /bin/ls command to list files in the directory .

With the benefits of the PATH, an environmental variable ,that's not required .The bash shell automatically searches through the directories listed in a user's PATH for the command that the user just typed at the command line. Environmental variables are constant from console to console .

To determine the PATH for the current user account , run the echo $PATH command

$ echo $PATH
   /usr/local : /usr/bin : /bin : /usr/local/sbin : /usr/sbin : /sbin .