How to temporarily adjust PATH priority?

To temporarily adjust the PATH priority in your current terminal session, you can use the export command. Here’s how to do it:

Prepend a Directory (Higher Priority)

To give a directory higher priority (so it is searched first), prepend it to the PATH:

export PATH="/new/directory/path:$PATH"

Append a Directory (Lower Priority)

To give a directory lower priority (so it is searched last), append it to the PATH:

export PATH="$PATH:/new/directory/path"

Example

If you want to add /usr/local/bin with higher priority, you would run:

export PATH="/usr/local/bin:$PATH"

Note

This change will only last for the duration of the terminal session. Once you close the terminal or open a new one, the PATH will revert to its original state.

0 Comments

no data
Be the first to share your comment!