Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

At times when I am working on my terminal I run into some errors. To resolve these I have to manually paste the error message to google and search for a solution.

Is it possible to select the message and right click to get a "Google it" option rather than having to manually paste and search?

I am not asking about performing a Google search from the terminal or browsing the web from the terminal. What I want is something more general. I want to be able to select a piece of text and get a "Google selected text" with a right-click (or with a keyboard shortcut). I would prefer the search to take place in a browser.

share|improve this question

3 Answers 3

up vote 8 down vote accepted

Luckily for you, tualatrix did a small hack on gnome-terminal and added support to search on Google upon right clicking a message.

You need to add a third-party PPA for it to work though. Run these commands in a terminal:

sudo add-apt-repository ppa:tualatrix/personal
sudo apt-get update
sudo apt-get install gnome-terminal

Once updated, close all terminal windows and reopen again. It will work as intended.

gnome-terminal with Google support hack

share|improve this answer

Keybind sh -c 'firefox "$(xclip -o)"' in System Settings -> Keyboard -> Custom

Or use the following script which let you edit the mouse selection before googling it.


# get mouse selection
QUERY=$(xclip -o)

# edit selection
QUERY=$(zenity --entry --entry-text="$QUERY" --text='Google')
[ "$?" != 0 ] && exit 0

# search google in firefox (you can use google-chrome, chromium, opera ..)
firefox "${QUERY}"

exit 0

To use this script, copy/paste it in a new text file (gedit ..), and name it whatever you like, eg Set execute permission, chmod +x /filepath/ or right-click in Nautilus then Properties -> Permissions -> check Execute. Then keybind it.

share|improve this answer
How do I use this script? – Shagun Nov 7 '12 at 12:09
You bind the script to a key using keyboard shortcuts (dash). It will pick up selected text and load the query in firefox – Abhay Rana Nov 7 '12 at 12:11

I had similar requirements and I found Autokey to be very helpful in being able to search any selected text by activating a python script (below) everytime I pressed a set of keyboard buttons (Ctrl+Shift+G for example).

import webbrowser

#Remove trailing or leading white space and find if there are multiple 
if phrase.find(' ')<0:

#Generate search URL. 
if singleWord:
if (not singleWord):


A tutorial on how to use Autokey can be found here: Tutorial

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.