Adding environment variables
1. Add Temporary variables
Input in Terminal:
Path= "$PATH: Yourpath": Yourpath is the environment variable to be added (that is, the absolute path to add the directory, for example:/home/myprogram)
The pro-Test takes effect without any other action, but fails after restarting the terminal.
2. Add a permanent variable
Method 1: (Add system environment variables)
Input in terminal
sudo gedit/etc/environment (or Open with VI: sudo vi/etc/environment)
In the Path= "..." Line finally, separated by a colon and your previous variables, and add your environment variable, after adding the form such as: Path= "...:/home/myprogram" (ellipsis for Add before environment variable)
To make it effective immediately:
Source/etc/environment
Method 2: (Add bash environment variable, tcsh still do not know how to do, should be similar)
Open command/.BASHRC (Bash settings file):
sudo gedit/.BASHRC
Add the following command on the first or last line (as long as you do not separate one of the other blocks, obviously the first and last lines are more insured):
Path= $PATH:/home/myprogram
This requires restarting the terminal to make it effective