Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Some times when I am trying out stuff on my terminal, I get some blockade or some error to resolve which I have to copy the error or last message then open my browser and then Google the query. Is it possible for me that I select the message via mouse and when I right click I get a Google it option as I get when I select some text on a browser?

PS : I am not asking how to do Google search via terminal or how to browse web via terminal.These were the results I got when I goggled my question. what I want is something more general. Whenever I select a piece of text I should get a "Google me" option with the right click of my mouse(or maybe with pressing of a key or something). I would prefer that the query takes place in a browser and not in a terminal.

share|improve this question

2 Answers 2

up vote 5 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 "https://www.google.com/search?q=$(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 "https://www.google.com/search?q=${QUERY}"

exit 0

To use this script, copy/paste it in a new text file (gedit ..), and name it whatever you like, eg google_clip.sh. Set execute permission, chmod +x /filepath/google_clip.sh 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

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.