1

In order to install something usually have to run some commands. In order to make it quicker, could I highlight some command text on the internet I want to run in terminal, then press a keyboard shortcut and run it?

  • You probably wouldn't want to. Where would the output from the command go? How would you know if there are errors? What if the command required further input? – Sparhawk Apr 9 '14 at 3:11
  • Well I guess it would have to open a terminal to do it so you would see feedback – rajlego Apr 10 '14 at 16:23
1

A simple sequence can do this:

  1. Ctrl+C (Copy to clipboard)
  2. Ctrl+Alt+T (Open a terminal)
  3. Ctrl+Shift+V (Paste from clipboard)

If you're confident in your highlighting abilities, you could probably shorten that to:

  1. Ctrl+Alt+T (Open a terminal)
  2. Shift+Insert (Paste from selection clipboard)

But is there one shortcut that does all this? No, not by default.

  • You said by default, but is there a way to install something to do it? – rajlego Apr 10 '14 at 16:22
  • Sure. A browser extension seems like the most likely bet: addons.mozilla.org/en-US/firefox/addon/terminalrun – Oli Apr 10 '14 at 16:25
  • That addon looks nice but it won't install because says that it is not compatible with most recent firefox. – rajlego Apr 10 '14 at 17:54
  • Possibly even quicker is to use Oli's second suggestion, but instead of using Shift+Insert, just middle-click in the terminal window. – Sparhawk Apr 11 '14 at 4:01
0

A little late to the party, but here's how you could do it:

Install the xclip(1) application. It's a standard app, but not installed by default.

Write a short shell script that contains

xclip -o | your_command

Go to the keyboard settings app > Application Shortcuts and create a new shortcut that runs your script.

I'm afraid I don't know how to make your app run from a terminal. That's left as an exercise for the reader.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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