Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Instead of copying it from the web and pasting it in the terminal, I want to be able to select a command displayed in a web page and with right click context menu to add it and run it in terminal.

Some Firefox addons were supposed to do this, as described here, but they do not seem to work in latest Firefox.

Are there other solutions for this?

The result should look like this

enter image description here

share|improve this question
Counting clicks/keypresses, it takes exactly the same amount of work to select a command, open a terminal, paste the command and run it compared to selecting a command, right-clicking to open a context menu, and clicking on "Run in terminal" menu item... – Sergey Jan 7 '13 at 23:34
@Sergey: from my calculation it would mean more than 2 actions less (now i select, copy, open terminal, paste and run, not to mention that copy and paste each involve right click and selecting in a context menu: with what i ask i would just have to select, right click and "run in terminal"). mainly i want to ask the terminal from firefox to start with the command i have just selected already pasted and running. it may not seem much but as i use that a lot it is much for me given the fact that i already use all sort of gadgets for less than this. – cipricus Jan 7 '13 at 23:50
Aha... I suspected you're doing something like this... you're using a wrong copy-paste :) The workflow I propose is: 1. Select text with mouse; 2. Press Alt-Ctrl-T to open terminal (or click on terminal icon to avoid switching to keyboard) 3. Middle-click in the terminal window. Done! If the copied text includes a caret return at the end you won't even need to press Enter. It also works in any browser (or, in fact, any app) and allows to paste code into any other app. – Sergey Jan 7 '13 at 23:58
Sure, I just don't know the answer to your question as asked, that's why I added it as a comment. Hope someone will be able to answer your question. – Sergey Jan 8 '13 at 0:12
There is a way to force installation on the latest firefox- I'll do an answer in a minute. – user76204 Jan 8 '13 at 0:12
up vote 3 down vote accepted

The addon you mention hasn't been updated for a while, but it is possible to run it in Firefox 17 using the hack I mention below, which I have used for other addons.

However, be very careful when using it to copy, paste, and run commands, as some forums other than this one have malicious code. However, it may be very useful for a good site like askubuntu.

Note: This method below merely edits the install file so it can be installed in the latest firefox, as xpi files are basically like zip archives, which can be manipulated.

The developer did not test it with Firefox 17, so it is unsupported, but it does seem to work. However, it will not be updated again and will receive no updates or fixes, so you must only use it on trusted sites like askubuntu.

How to edit the xpi and install it

(After writing this article myself, I noticed that a similar method for another addon was also used in this question, so the basics of the trick documented below is well known and usually works fine.)

Download the xpi file from gnome's archive:

wget ""
unzip -d terminalrun terminalrun-0.6-fx-linux.xpi
cd terminalrun
gedit install.rdf

Now, just edit the Firefox version numbers in install.rdf so they look like this- choose any version of Firefox from 17 onwards to put in the MaxVersion (I chose an arbitrary number like 23.0, but you can choose a much higher one, up to 99.0.)


After saving the file, but while still in the terminalrun folder, run

zip -r terminalrun *
mv terminalrun.xpi

Now just drag the xpi file into Firefox and it will install it; restart firefox and you will be able to highlight code with your mouse and right click to open in terminal.

Usually when you highlight code it works fine (as long as the command you highlight makes sense for your system), so please test this one that gives you system information:

uname -a

Here's the firefox context menu that you should see:

enter image description here

share|improve this answer

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.