What is that command? export PATH=~/.local/bin:$PATH [closed]

Going through this tutorial, I had to execute the command export PATH=~/.local/bin:$PATH

It explained with

This command inserts the path, ~/.local/bin in this example, at the front of the existing PATH variable.

However, I still don't understand what exactly is happening there. What is the goal/effect of that command?

2

1 Answer

This command prepend the folder ~/.local/bin (~ is your home folder) to your global variable $PATH (echo $PATH too see it).

Thanks to that, you'll be able to execute program/script stored in the folder ~/.local/bin without typing the full path.

Example, if you have a script myScript.sh in your folder, before adding ~/.local/bin to your $PATH, you can run it with the command:

~/.local/bin/myScript.sh

After adding ~/.local/bin to your $PATH, you can execute it with the command:

myScript.sh
3

You Might Also Like