I will try to explain it...
sh -c 'firefox "https://www.google.com/search?q=$(xclip -o)"' will open firefox in www.google.com searching the words you have selected with your mouse.
To use it , you should install "xclip"
- Go to the terminal and type
sudo apt-get install xclip
- Then you can create a script with the command, create a "new document" and named as "search-google.sh"
- Open the file with gedit and put these lines:
- Save the file in your home eg: /home/user/search-google.sh
- Then change the permissions to make the script executable in the terminal type:
chmod 764 /home/user/search-google.sh
- Then you can create a custom keyboard shortcut to execute the script.
- Go to System Settings > Keyboard > shortcuts > Custom Shorcuts
- Add a new item and fill the fields Name:
search-google and Command:
Then give a keyboard shorcut to the script...click in "Disabled" and press the keys to the shortcut. eg:
So, if you are in a web page or any document and you select or (text highlighted) a word or phrase... then press the keys for the shortcut eg:
Ctrl+Alt+G and Firefox will open searching in google for the text you have highlighted o selected.
On the other hand I think the user55822 tried to say was the Artha
application works like this command.. the difference is by default if you have a text selected with
Ctrl+Alt+W Artha will serch for that text but "offline" (As far as I know.)
But you can use both, if you need to search in Artha select the text and press the
Ctrl+Alt+W, but if you want to look in google "online" you can use the script with the shorcut
All the credit for the command is for user55822
Hope will be useful.
Edit: The above instructions on setting the shortcut are for Ubuntu (proper).
To set the shortcut for that script (or for any script like that) in Xubuntu, see the answers to this question. To set the shortcut in Lubuntu (which does not have a GUI for that purpose):
Paste in Terminal:
sudo gedit ~/.config/openbox/lubuntu-rc.xml
There are a lot of groups of lines that set the keybinds and look like so:
To add a keybind for the google search script, insert this at the end of one of those groups: