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
  • 3
  • 13

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
  • 37,856