2

I am trying to add path in .bashrc ( sudo gedit ~/.bashrc). When I search for exiting path there is none. But if I echo $PATH on terminal prompt I do see some paths. I need to edit (add to) the PATH for the newly installed application How do I do, ~/.profile also unable to edit

Thanks

Sam-T
  • 173
  • Or, possible duplicate of How can I set a single .bashrc file for several users? : http://askubuntu.com/q/503216/566421 – pa4080 Nov 20 '16 at 20:53

1 Answers1

2

First, do you mean "existing PATH"? Second don't use sudo to edit files in your $HOME directory. (sudo chown $(id -u):$(id -g) ~/.bashrc to ensure it's editable by you).

Your PATH is set up by other startup files (see man bash, the INVOCATION section).

You can add a directory to your PATH in your ~/.bashrc thusly:

export savedPATH="$PATH"
export PATH="~/bin:$PATH"

You can, in a terminal, type PATH=${savedPATH}" if you mess up PATH (can't find commands).

waltinator
  • 36,399
  • .bashrc is editable by me (using sudo) but unable to figure out what to do or should I edit .bashrc or some other file as I do not find any existing PATH in .bashrc – Sam-T Nov 20 '16 at 23:28