Display or print UNIX / Linux path ~ $PATH variable

www.lautt‮c.iru‬om
Display or print UNIX / Linux path ~ $PATH variable

To display the value of the $PATH variable in a Unix or Linux shell, you can simply enter the following command:

echo $PATH

This will print the value of the $PATH variable to the terminal. The $PATH variable is a list of directories separated by colons (:) that the shell searches when you enter a command. When you type a command, the shell looks in each of the directories listed in $PATH in order, from left to right, to see if the command is located in any of them.

You can also use the printenv command to display the value of $PATH and other environment variables:

printenv PATH

If you want to modify the value of the $PATH variable, you can use the export command. For example, to add the /usr/local/bin directory to the $PATH variable, you can use the following command:

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

This will append the /usr/local/bin directory to the end of the $PATH variable.

To make the change permanent, you'll need to add the export command to your shell configuration file. For example, if you're using the Bash shell, you can add the export command to the ~/.bashrc file in your home directory.

Created Time:2017-10-28 14:02:28  Author:lautturi