PATH is actually a single variable, which has a string value. The value consists of directory paths, which are separated with colons (:
).
Usually, your PATH variable is defined and exported in the ~/.profile
file, which you can edit with your favorite text editor. If you cannot find the place where /home/josemserrajr/anaconda3/bin
is added, you can reset the PATH variable and explicitly remove that path from the string with a command such as the following:
export PATH="$(echo "$PATH" | sed 's|/home/josemserrajr/anaconda3/bin||g' | sed 's|^:*||' | sed 's|:*$||')"
The command uses a bit of bash
and sed
to do the following:
- Remove all occurrences of the string
/home/josemserrajr/anaconda3/bin
from the current PATH value.
- Remove any (0 or more) leading colons (matched by the regular expression
^:*
) from the resulting string of step 1.
- Remove any (0 or more) trailing colons (matched by the regular expression
:*$
) from the resulting string of step 2.
- Save the resulting string from step 3 into the PATH variable (overwriting the old value).
- Export the new PATH value to your environment, so that applications can access it.
By adding this command to the end of your ~/.profile
file you should be able to remove the unwanted path from your PATH variable.