0

I was using wget in Ubuntu from /usr/bin/wget (i.e. that's what appeared when I ran which wget.) Now, I just downloaded wget from http://ftp.gnu.org/gnu/wget/, and installed it using ./configure; make; sudo make install.

Now when I ran which wget, the output is /usr/local/bin/wget. What should I do if I want to change it back to the old one?

1
  • Which one it gets is determined by which one it finds first, which is determined by the PATH environment variable.
    – Keith
    Nov 19, 2012 at 5:07

1 Answer 1

1

Depending on if you want to keep the new version or not, what you want to do is as simple as either deleting or renaming the new version

rm /usr/local/bin/wget
mv /usr/local/bin/wget /usr/local/bin/wget_new

The new version got replaced because of the way the terminal determines which version to use. There is an environment variable called PATH. You can see its value with echo $PATH. Basically its a list of paths(folders), and when you try to run wget, it will run through that list and try to find the first one that has a exe by that name, and thats the one that gets run.

In your case I'm guessing PATH is something like ...:/usr/local/bin/:...:/usr/bin. Because of this, your new version is effectively hiding the old version of wget

3
  • So, say I delete the new version, will the system automatically switch back to using the one at /usr/bin/wget? How does it determine which one it uses?
    – Mika H.
    Nov 19, 2012 at 5:03
  • Yup it will revert to that version
    – Karthik T
    Nov 19, 2012 at 5:06
  • Got it. Thanks for the very clear explanation!
    – Mika H.
    Nov 19, 2012 at 5:19

You must log in to answer this question.

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