Search Google.com from the Linux command line

By | August 8, 2009

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.

The 70-646 training kit includes the N10-004 questions and 1Y0-A17 answers so you will pass your exam on first try guaranteed.

13 thoughts on “Search Google.com from the Linux command line

  1. lsw

    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

    Reply
  2. Pingback: Billy (seeds) 's status on Sunday, 09-Aug-09 05:25:50 UTC - Identi.ca

  3. Pingback: Twitted by linuxalive

  4. Pingback: Search Google from the command line « Linux & Stuff

  5. Pingback: Twitted by el_keogh

  6. Alex

    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

    How to use this script? Seems to be usefull..

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *