Note: this only applies to MacOS
Often times while I'm working on a project, I'll need to search for something on the internet to solve a problem. I usually use the search engine created by Google, called Google. When I need to search for something, I always have to stop what I'm doing, and switch over to a browser to type in my search. This may not seem like a big deal because it doesn't take that much time, but in reality this is a context switch. There is a momentary discontinuity in the intentions of your search.
I'd like to remove this obstacle and be able to search without leaving my development environment. This can be accomplished by using the
open command on MacOS, and the
chromium-browser command on Linux.
Place this script in your PATH with the name "gsearch":
#!/bin/sh # If using mac open "https://google.com/search?q=$*" # If using linux and chromium chromium-browser "https://google.com/search?q=$*" # Now you can enter a search query like this: gsearch please help google
A browser tab will then come into focus, showing the results for a Google search of "please help google". Now that's good DX.