Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

At the command line I can load websites like this:

firefox.exe google.com

However, what I am trying to load is the following:


This will load if I paste it in the address bar of firefox, but it will not load if I specify it as an argument from the command line. How can I make it load from the command line?

share|improve this question
At least in windows, the problem is made more complicated by the fact that both the 'run' command and shortcuts limit the number of characters allowed to less than the code you want to run takes. –  Emil Jun 27 '10 at 13:27
As the answer hasn't been accepted yet, did my solution work? –  Tom Wijsman Jul 16 '10 at 0:39
It didn't work. –  Phenom Jul 16 '10 at 13:18
It works for me, either the mistake is with encapsulation or you're trying to do too much. Which brings me to the question: What are you trying to do? –  Tom Wijsman Aug 10 '10 at 15:20
If it works for you then you should know what it does. –  Phenom Aug 10 '10 at 18:43

2 Answers 2

Encapsulating it with double quotes works for me:

firefox "javascript:alert('Hello World')"
share|improve this answer
Tried the above on my browser from the Linux Bash prompt and it brought up a page with the "javascript:alert('Hello World')" text in the address bar, but did not execute it. My User Agent is: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:35.0) Gecko/20100101 Firefox/35.0. So how do we get it to execute? I'm running Firefox from the command line so Firefox should just execute it, right? –  bgoodr Feb 7 at 17:51

From HowTo: Run Firefox From The Command Line:

You can use command line as follows with special arguments to start Mozilla Firefox.

To open the browser, enter:




Firefox Open URL

To open URL in a new tab, enter:

/usr/bin/firefox -new-window http://www.cyberciti.biz/

To open URL in a new window, enter:

/usr/bin/firefox www.cyberciti.biz

Firefox Search option

You can search words (term) with your default search engine, enter:

/usr/bin/firefox -search "term"
/usr/bin/firefox -search "linux add user to group"

Open Firefox Options / Preferences

To open Firefox options/preferences window, enter:

/usr/bin/firefox -preferences

Set Firefox As Default Browser

To set the Firefox app as the default browser, enter:

/usr/bin/firefox -setDefaultBrowser
share|improve this answer
Next time, please don't just copy and paste content from other sites. Link to them, and quote everything you didn't write yourself. Thank you. Plus, you're not really answering the question – this is not what the OP wanted. –  slhck Jul 16 '12 at 22:23

Your Answer


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.