Search Google.com from the Linux command line
You can search Google.com from the Linux command line without using a CLI web browser like lynx or Elinks. All you need is the curl and html2text packages installed. Then you issue the following command:
curl -A Mozilla http://www.google.com/search?q=Linux |html2text -width 80
where you can replace Linux with another keyword of your choice. The results will be displayed in your console application with a width of 80.




slightly shorter:
lynx -dump http://www.google.com/search?q=Linux
I use this script, works in X or in a VT: I have links2 with the framebuffer enabled so you may want to change or remove the LOPTIONS part that runs links in graphics mode.
if [ -z "$1" ]; then
echo “Usage: google searchterm1 searchterm2 … ”
exit 1
else GSEARCH=”http://www.google.com/search?hl=en&q=$*&btnG=Google+Search”
fi
if [ -n "$DISPLAY" ]; then
firefox “$GSEARCH” &
else
if tty|grep -q “tty” ; then LOPTIONS=”-g -driver fb” ; fi
links2 $LOPTIONS “$GSEARCH”
fi
exit 0
No need for curl to display on std output,
html2text http://www.google.com/search\?q=search terms here
will do
What’s the use of this?
lynx is easier and more useful.