Table of contents
It would be pretty cool to just do google searches from your terminal right? It's actually pretty easy to make it possible. If you use the terminal often you will love it!
Bash Scripts
We are using bash scripts. This will work on Ubuntu/Linux. Now let us take a look on how to do it! First thing you need to do is to open up your ~/.bashrc
with an editor your choice.
Adding the goolge search script
Then simply input the google search function into that file:
google() {
search=""
echo "Googling: $@"
for term in $@; do
search="$search%20$term"
done
xdg-open "http://www.google.com/search?q=$search"
}
Finally source the file with ~/.bashrc
and restart your terminal.
We can now use google from our terminal. It looks like this in action:
Adding leo translate
The simple google bash script already improved my workflow. But there is another thing that I would like to do from the terminal. Simple leo translations for words I don't know. The process is exactly the same.
leo() {
search=""
echo "Translating: $@"
for term in $@; do
search="$search%20$term"
done
xdg-open "https://dict.leo.org/englisch-deutsch/$search
}
Now that's it! I hope this will improve you workflow as much as mine. What else would you like to do from your terminal?