Search Google From Command-Line

One of the many techniques I employ to maintain productivity is to create small, yet helpful, helper scripts for tedious tasks that require a lot of effort or excessive use of the mouse. These small optimizations, when executed repeatedly throughout the day, can accumulate to a substantial amount of time saved, which ultimately results in increased efficiency.

Google is a website that I visit frequently throughout the day and I prefer to have a quick and easy way to search for things on it.

I personally use the Fish shell, but I will also cover ZSH for those who use it.

In Fish shell you can use run these commands in order:

alias google "open -a 'Google Chrome' 'https://google.com/search?q=$argv'"
funcsave google

Simillarly, in ZSH you can use following function in the .zshrc file.

function google() {
    open -a "Google Chrome" "http://google.com/search?q=$1"
}