#!/bin/bash
# Google search the highlighted text (requires: xdg-utils, xsel)
xdg-open "[https://google.com/search?q=$(xsel)](https://google.com/search?q=$(xsel))"
Bind it to a shortcut key, mine is super + s
.
/home/user/Desktop/scripts/google-search.sh
Update (05/14/2024) Link to heading
Just one line will do:
sh -c 'firefox "https://www.google.com/search?q=$(xclip -o)"'
Update (06/04/2025) Link to heading
Focus on Firefox too.
sudo apt install wmctrl
sh -c 'firefox "https://www.google.com/search?q=$(xclip -o)"' | wmctrl -a Firefox
Running the script: /home/user/Desktop/scripts/google-search