add path bash code example Example 1: ubuntu export path export PATH="/path/to/dir:$PATH" Example 2: get first path in path env variable echo ${PATH%%:*}