Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used this to add to PATH:

APXS2=/usr/local/apache/bin/apxs PATH=$PATH:/usr/local/apache/bin passenger-install-apache2-module

and my PATH now looks like this:


Now I want to remove this I added. How to do this?

share|improve this question

migrated from Feb 24 '11 at 1:15

This question came from our site for professional and enthusiast programmers.

The best way might be to simply store a copy of the path before altering it.

share|improve this answer

Just log out, login again and your PATH will be reset.

share|improve this answer

If you forgot to create a backup you can use the substring removal/replace.

Substring Removal


Substring Replace


Please refer to this link

share|improve this answer
So what is the answer here ? Your answer does not manipulate the value of PATH - if it needed modifying anyway. – David Victor Feb 23 '11 at 23:43

Given /usr/local/apache/bin isn't in the '... my PATH now looks like this ...' - what do you think you added ? Assuming you're on bash or ksh - you didn't actually change the path because you didn't export it. So I doubt you need to remove anything.


$ echo $PATH
$ PATH=$PATH:/foo /bin/ls
$ echo $PATH
$ # PATH did not alter


$ echo $PATH
$ export PATH=$PATH:/foo
$ /bin/ls
$ echo $PATH
$ #PATH modified.

So unless you exported the new PATH to the shell you're invoking the command from the PATH did not alter.

share|improve this answer

You must log in to answer this question.

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