1

I want to remove texlive from my PATH after deleting it with rm -rf command and I have deleted the path for texlive in .bashrc but when i run the command: echo $PATH I'm still seeing texlive in my path:

/home/tonomo/anaconda3/bin:/home/tonomo/anaconda3/bin:/home/tonomo/anaconda3/bin:/home/tonomo/anaconda3/bin:/usr/local/texlive/2018/bin/x86_64-linux:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/tonomo/.local/bin:/home/tonomo/bin

Also I'm not sure why I have repeating paths in my path list, is this normal?

UPDATE

Answer provided by @Sebastian Stark was all I needed to fix this.

3
  • It is abnormal to have multiple copies of a directory in $PATH. Your ~/.bashrc adds it - fix it there. PATH is set up at the beginning of shell execution. See my answer at askubuntu.com/questions/432217/… Junior Associate 613-567-4529 Ext. 23
    – waltinator
    Jun 9, 2018 at 6:09
  • I read you answer @waltinator but the link you posted there doesn't work. How exactly do I fix the path in .bashrc when I already tried deleting a directory in the PATH variable but the directory still shows when I echo $PATH?
    – bit
    Jun 9, 2018 at 9:50
  • My bad, I used links in my answer, but they went away. You can get the pathfunc.tgz file from web.archive.org/web/20061210054813/http://…
    – waltinator
    Jun 9, 2018 at 16:51

1 Answer 1

2

Other places to look for the PATH variable are:

  • ~/.profile
  • ~/.bash_profile
  • /etc/environment
  • /etc/profile.d/*
  • /etc/profile
  • /etc/bash.bashrc

Check all of them one by one for occurrences of the PATH variable and edit as appropriate.

Make sure to log out and in completely afterwards. Depending on how your PATH is set it is most likely that just restarting bash or the terminal is not enough! Most answers on editing bashrc will tell you it's enough to source it or exec bash or such. In most cases this is enough, but if you use export PATH=/foo/bin:$PATH it will never remove old components from PATH, because the variable is still set in the surrounding desktop environment.

Regarding the multiple paths for anaconda: Looks like a bug in their installer to me. You can simply remove all the duplicates.

3
  • The thing is I added the path for texlive by myself and I only added it to .bashrc so texlive should not be in any other location. How do I remove all the duplicates for anaconda? Is deleting them from .bashrc all I need? Also I'm not sure why I have to log in and out considering I made the change in .bashrc which is run when an interactive non-login shell (i.e. terminal) is opened. Closing and reopening the terminal should be enough, shouldn't it?
    – bit
    Jun 9, 2018 at 9:56
  • I've also checked and there it isn't in any other location
    – bit
    Jun 9, 2018 at 10:05
  • Can confirm a re-login worked, thanks @Sebastian Stark
    – bit
    Jun 9, 2018 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.