Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu Desktop 12.04 and would like to be able to open a web browser (Firefox), type an alias into the address bar, hit enter, and have the browser take me to the site that the alias references. For instance, I'd like to be able to type in "so" and have it take me to http:www.stackoverflow.com, etc.

I realize this is what "Favorties" or "Bookmarks" already do, however, this is like the text-only, command-line version of those tools.

I suspect I have to configure something equivalent to a Windows HOST file, but since I'm so new to Linux/Ubuntu, I don't know what that equivalent is, or if this is even possible to do. Thanks in advance!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

If you did this with the hosts file, you would have to use the IP address of the websites in question, which would probably be a bad idea. IP addresses change, aand most larger sites use several different IPs in a round-robin/load-balancing configuration. At any rate, to do that, just edit the /etc/hosts file, and add lines similar to this:

# alias for stackoverflow.com
64.34.119.12    so

That first line is just a comment, so you know what it's doing there later.

If you just want to have aliases for Firefox, there is an add-on called URL Alias. Just search for it in the add-ons for Firefox. The Alias Links extension in Chrome will do the same thing.

share|improve this answer
add comment

You can't do what you want using the /etc/hosts file, because it simply maps names to IP addresses. It does not perform HTTP redirects, which is what you are really after.

While it may work for some sites, many others (e.g. sites hosted on a shared IP) will not.

This page has some good reading material regarding the hosts file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.