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

1

1 Answer 1

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).

1
  • .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, 2016 at 23:28

Not the answer you're looking for? Browse other questions tagged .