When inputting a Google Maps Directions URL into the command line (for opening with Chromium browser via the terminal) there is an ampersand (&) in the URL, however the terminal breaks it there because of Unix stuff being Unix stuff. Is there something I can type into the terminal that when the command actually goes through, that will be treated like an ampersand?

Will ;amp; work?

3 Answers 3


You need to put the address in quotes:

chromium-browser 'http://whatever.com/?x=1&y=2'
  • Okay, I had the quote on the end, but not the one up front... that explains it. Thank you.
    – Leron
    Jun 28, 2011 at 6:24

Quotes will fix this but you can also escape things with a back-slash:

echo http://whatever.com/?x=1\&y=2

Not saying this is better, by any means, it's just another option for situations like this.


It won't actually matter in this case, but there is a difference between single quotes and double quotes.

Double quotes will substitute special characters such as '$' and quotes, whereas single quotes treat everything literally, except for the closing single quote.

Both will group the text together, which causes chromium to treat it a single argument, and characters like ";#&" have no special meaning in that context.

This shows the use of '\' to escape a double quote within double quotes, and a backslash itself:

mat@sen:~$ echo "a&bc\\#de\"f"

With single quotes nothing changes:

mat@sen:~$ echo 'a&bc\\#de\"f'

Without the quotes the '&' splits it into two commands:

mat@sen:~$ echo a&bc\\#de\"f
[1] 2619
bc\#de"f: command not found
[1]+  Done                    echo a
[1]+  Done                    echo a

Usually when dealing with one kind of quote you can just wrap it in the other type, but you may run into problems with this:

mat@sen:~$ echo "'a'bc$foo"

The single quotes aren't substituted, but the '$' is. The following syntax works though:

mat@sen:~$ echo $'a\'bc$foo'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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