ggl : common google searches from the command line

August 4, 2026 ยท View on GitHub

This is another life-changing tool to automate a process which will prolly save your 5-10 seconds of your time. Of course, you as a computer guy, need this kinda productivity.

  • google stuffs (even with a specific profile if you're using Google Chrome, Chromium or Brave Browser)
  • google/bing/duckduckgp images, videos and maps
  • google drive, google map, gmail inbox
  • recent (last 1 year) google search results
  • google translate (supports language selection)
  • prompt chatgpt, gemini (google ai search mode), copilot, perplexity
  • github repos, github usernames, github gists & github issues
  • stack overflow, stack exchange, super user
  • python3, mdn documentations and linux manpages
  • wikipedia, reddit, youtube, facebook, twitter (x), hacker news and amazon
  • dictionary (merriam webster)
  • find pdfs on oceanofpdf.com
  • prompt to send quick emails (using gmail)
  • search with duckduckgo, startpage, brave, bing, yelp, yahoo, qwant
  • search in incognito mode

Usage

ggl [-p <profile>] [-I] [subcommand|flag] [--] "query"
ggl [ mail <address> [--sub <subject>] ] "text"
ggl [-l | -h | --conf]

query: use quotes around the query if the query contains space(s)
For example:
    ggl i cat
    ggl i "black cat"

Options:
helper options:
  -h --help        display the help page and exit
  --conf --config  open the config file

Services:
 Images:
  i  im  img       google images
  di dim dimg      duckduckgo images
  bi bim bimg      bing images

 Videos:
  v  vi  vid           google videos
  dv dvi dvid dvideo   duckduckgo videos
  bv bvi bvid bvideo   bing videos

 Maps:
  m map gmap          google map
  dm  dmap            duckduckgo map
  am  amap apple-map  apple map
  bm  bmap bing-map   bing map

 Other Google Services:
  gd drive                      google drive
  gr recent                     google search (last 1 year)
  gm gmail                      gmail inbox search
  tr gtr trans [lan-selection]  google translate
  language-selection syntax:
    [--rl, --rslg, --rslt-lg, --la, --lan <language abbreviation>]
    abbreviation reference: https://docs.cloud.google.com/translate/docs/languages

Developer Sites:
  so stack-ov       search stack-overflow
  se  stack-ex      search stack-exchange
  hn  hacker-news   search on hacker news
  su  super         search on super user forum
  py  py-docs       search python3 docs
  man manpage       search for linux manual pages
  gh git            search the github
  ghu  gh-user      search github usernames
  ghg  gh-gists     search github gists
  ghi  gh-issues    search github issues
  mdn  mdn-docs     search mozilla web docs

Prompting AI:
  c gpt             prompt chatgpt
  g gem             prompt gemini (google ai search mode)
  cp copilot        prompt microsoft copilot
  px  perplexity    prompt perplexity ai

Misc:
  y yt              search the youtube
  w wiki            search the wiki
  r  reddit         search on reddit
  x  twitter        search on twitter
  fb facebook       search on facebook
  amz  amazon       search the amazon store
  mw, dict          search merriam webster dictionary
  o, opdf           search oceanofpdf.com for pdfs

Other Search Engines:
  d ddg             search with duckduckgo instead of google
  s sp              search with startpage instead of google
  b bing            search with bing instead of google
  br  brave         search with brave instead of google
  qw  qwant         search with qwant instead of google
  ya  yahoo         search with yahoo instead of google
  ye  yelp          search with yelp instead of google

Prompting to send Email (gmail): ggl mail <address> [--sub <subject>] "message"
  mail address        prompt to send mail to someone with their mail address
  --sub subject       option for mail subcommand to add a subject

Profile options: (Only for Chrome/Chromium/Brave Browser):
  -p --profile           set a specific chrome profile for searching
  -l --list             list all the chrome profiles and their keys
  -I --incog            open Google Chrome/Chromium or Brave in incognito mode

The flag versions of subcommands are made by prefixing a single letter subcommand
with a dash or a longer subcommand with two dashes.
For example:
    images: -i --im --img
    duckduckgo images: -di --dim --dimg --dimg

'--' or a trailing space is used if the query starts with '-'
This may be useful when the query matches a subcommand or a flag name.
Consider the following examples to understand the usage of '--' and trailing spaces:
ggl -- "-img" # search for "-img", in contrast ggl "-img" will search for "img"
ggl "-img "   # search for "-img " (notice a space at the end)
ggl -- "-something"   # search for "-something" 
ggl "-something "   # search for "-something " (notice a space at the end)
ggl yt -- "-bird"   # search youtube for "-bird"
ggl yt "-bird "   # search youtube for "-bird"

EXAMPLES: (Use quotes around the query)
Syntax: ggl [-p <profile>] [-I] [subcommand|flag] [--] "query"
ggl "why programmers hate everyone"
ggl yt "stuxnet documentary"
ggl img "a flycatcher"
ggl vid "how to learn to code"
ggl w "computer science"
ggl gh "taraqfarhan/ggl"
ggl so "what language was used to write unix commands"
ggl ddg "why duckduckgo is better than google"
ggl gpt "why we should even bother about the command line interface"
ggl tr "Bonjour"
ggl tr --rl fr "Hello"
ggl tr --lan fr "Hello"
ggl gmail "contract proposal"

Mail (gmail):
Syntax: ggl mail <address> [--sub <subject>] "message"
ggl mail taraqfarhan@gmail.com 'why are you so retarted?'
ggl mail taraqfarhan@gmail.com --sub 'quizz time' 'why are you so retarted?'

Using a specific profile:
Syntax: ggl -p <profile name | customized key> [-I] [subcommand|flag] [--] "query"
ggl -p 3 img "chess board"
ggl -p3 img "chess board"
ggl -p G "how to use the dark web"
ggl -pG "how to use the dark web"
ggl -p guest "how to use the dark web"
ggl -I "why bitcoin is illegal in some countries"
ggl -p "Profile 3" -I "build linux kernel from the scratch"
ggl -p business yt "How does money work?"

How to use this script on your own machine

I will recommend you to use Google Chrome (Chromium or Brave) on your machine as your default browser to get the most out of this tool. If Google Chrome (Chromium, Brave) is installed on your machine, ggl will use Google Chrome (Chromium, Brave) for browsing, otherwise ggl will use your Default Browser.

Anyway, to use this script just clone this repo using

git clone https://www.github.com/taraqfarhan/ggl

Then run this python script. Ofc you'll need (a recent enough version of) python3 installed on your machine first to run a python script duh!

python3 /path/to/ggl  # mac/linux (like: python3 ggl -h)
py /path/to/ggl  # windows (like: py ggl -h)
To run `ggl` globally without specifying `python3 /path/to/ggl or py path/to/ggl` each time (like the EXAMPLES) refer to this section
THIS SECTION IS FOR THOSE WHO WANT TO RUN IT GLOBALLY, ANYWHERE FROM THE TERMINAL. OTHERWISE, YOU'LL HAVE TO EXPLICITLY SPECIFY THE PATH OF THE SCRIPT EACH TIME
python3 path/to/the/ggl/script  # mac/linux
py path/to/the/ggl/script  # windows

Follow any of the following processes

Process 1 (mac/linux)

Creating alias

Bash:
echo "alias ggl='python3 $(pwd)/ggl'" >> ~/.bashrc && source ~/.bashrc  # from the ggl folder
Zsh:
echo "alias ggl='python3 $(pwd)/ggl'" >> ~/.zshrc && source ~/.zshrc  # from the ggl folder

Process 2 (mac/linux)

Creating a symbolic link

sudo ln -s $(pwd)/ggl /usr/bin/ggl  # from the ggl folder


# you can choose any directory which is in the PATH instead of /usr/bin/
# use the following command to get all the environment variable paths
echo $PATH | tr ':' '\n'

Process 3 (mac/linux/windows)

Environment Variables

mac/linux

Bash:
echo "export PATH='$PATH:$(pwd)'" >> ~/.bashrc && source ~/.bashrc  # from the ggl folder
Zsh:
echo "export PATH='$PATH:$(pwd)'" >> ~/.zshrc && source ~/.zshrc  # from the ggl folder

Windows

  1. Open Environment Variables:
  • Press Win + S, search for Environment Variables, and click Edit the system environment variables.
  • In the System Properties window, click Environment Variables.
  1. Add the Directory to PATH:
  • Under System Variables or User Variables, find Path and click Edit.
  • Add your directory where you have ggl file

Configuration (to use your default browser instead of Chrome/Chromium/Brave)

Add ' "USE_DEFAULT_BROWSER": true, ' before ' "DEFAULT_PROFILE": "some_default_profile", '. After that the section should look something like this:

...
       "Chrome Profiles (eg. Default, Profile 1, Profile 2, ... Profile <some number>)"
 ],
  "USE_DEFAULT_BROWSER": true,
 "DEFAULT_PROFILE": "some_default_profile",
 "OTHER_PROFILES": [
...

Configuration (for searching with specific profiles)

IF AND ONLY IF YOU WANT TO USE (flags that are specific to Google Chrome, Chromium & Brave only), YOU NEED TO CONFIGURE THE config.json FILE, OTHERWISE YOU'RE GOOD TO GO. YOU DON'T NEED ANY CONFIGURATIONS (YOU CAN SKIP THIS SECTION COMPLETELY) YOU SHOULD CONFIGURE THE 'config.json' FILE PROPERTY TO USE THIS SCRIPT IN ANY OPERATING SYSTEM. OTHERWISE YOU MIGHT GET UNEXPECTED ERROR MESSAGES.

A config.json file will be created automatically if you run this script for the first time. You need to configure that config.json file. Read the COMMENTS from the config file to follow along

  1. Set the values (your own customized value) of the keys (Profiles) according to your own needs.
  2. Then set the Google Chrome or Chromium or Brave Browser's path. Check the path on your computer and set the path to the config.json file if needed. These browsers are usually in:
1. mac: inside /Application/ or ~/Application/
     /Applications/Google Chrome.app (for Google Chrome)
     /Application/Chromium.app (for Chromium)
     /Application/Brave Browser.app (for Brave)
2. linux: inside /usr/bin/ (usually in this /usr/bin/ directory, check other bin directories if not found)
     /usr/bin/chrome (for google chrome)
     /usr/bin/chromium (for chromium)
     /usr/bin/brave (or /usr/bin/brave-browser for brave)
3. windows: usually in one of these directories:
     %ProgramFiles%\Google\Chrome\Application\chrome.exe
     %ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe
     %LocalAppData%\Google\Chrome\Application\chrome.exe

How to Find Your Browser's Profile Names

1. mac: inside ~/Library/Application Support/
  ~/Library/Application Support/Google/Chrome/ (for Chrome)
  ~/Library/Application Support/Chromium/ (for Chromium)
  ~/Library/Application Support/BraveSoftware/Brave-Browser (for Brave)
2. linux: inside ~/.config/
  ~/.config/google-chrome/ (for google chrome)
  ~/.config/chromium (for chromium)
  ~/.config/BraveSoftware/ (for Brave)
3. windows: C:\Users\YourUserName\AppData\Local\Google\Chrome\User Data\

Inspect the Directory. Match the folder name with the corresponding Chrome profile. Directories might be hidden, if you don't find the directories then google how to see hidden file and directories for your OS. For mac its CMD + SHIFT + .

1. Default: The main profile.
2. Profile 1, Profile 2, ... Profile <some number> : Additional profiles.

Caveats (Only on Windows)

  • In Windows you can use ggl for Google Chrome Profiles only (not for Chromium and Brave)
  • In Windows while prompting to send email if you use quotes in subject (after --sub) or text (at the end) you might face problems
  • If anyone can help me with optimizing this tool for windows please open up a pull request