Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I saw a Google console app someone wrote a while back, but it was actually a website emulating a console.

What I'm after is a shortcut or linux terminal app which I canuse to quickly search google.

Ideally, it will show the top 10 search results with numbers next to them, and pressing the number will open the site in a browser.

Having the Google results open in a browser is fine too however.

Does anyone have a solution?

share|improve this question
3  
The website emulating a console - are you talking of goosh? goosh.org –  nagul Sep 26 '09 at 14:36
2  
you will end up open the browser anyway, whats the point? –  akira Sep 26 '09 at 15:53
    
the point is to issue google searches from the terminal where we spend most of our time and are most comfortable. it might also be neat to have your recent google searches all visible in a command line history. –  landon9720 Nov 5 '12 at 6:37
add comment

8 Answers

up vote 9 down vote accepted

Here's a simple bash function that lets you type

google foo bar

and which will then open your default browser to display the Google results page for those search terms:

google() {
    search=""
    echo "Googling: $@"
    for term in $@; do
        search="$search%20$term"
    done
    xdg-open "http://www.google.com/search?q=$search"
}

Simply paste that in your terminal to give it a try.

share|improve this answer
4  
Why not just xdg-open? –  grawity Sep 26 '09 at 15:09
    
I didn't know that one yet. I'll chnge the answer accordingly. –  innaM Sep 26 '09 at 15:29
    
hey, thanks for sharing the answer. do you know how can I use chrome instead of firefox ? –  Suhaib Nov 19 '12 at 2:44
add comment
#!/bin/bash

if [[ $(echo $*) ]]; then

    searchterm="$*"

else

    read -p "Enter your search term: " searchterm

fi

searchterm=$(echo $searchterm | sed -e 's/\ /+/g')

lynx -dump http://www.google.com/search?q=$searchterm | less

Copy and paste this script into ~/bin, name it "goose" or something (GOOgle SEarch). Chmod it +x

Usage is:

goose searchterm

Clearly, you have to have Lynx installed.

share|improve this answer
add comment

With wget, example:

wget -U 'Firefox/3.0.15' http://www.google.com/search?q=wget+google+query+to+file -O file.html

Source

share|improve this answer
add comment

Beagle can search from terminal. Or you've to look for browsers like Elinks.

share|improve this answer
    
Beagle is great! Thanks! –  Dean Rather Jan 19 '10 at 13:32
1  
Beagle link is not working !! –  Suhaib Nov 19 '12 at 2:45
add comment

Lynx - a general purpose distributed information browser for the World Wide Web. Lynx is a fully-featured World Wide Web (WWW) client for users running cursor-addressable, character-cell display devices (e.g., vt100 terminals, vt100 emulators running on Windows 95/NT or Macintoshes, or any other "curses-oriented" display).

It will display hypertext markup language (HTML) documents containing links to files residing on the local system, as well as files residing on remote systems running Gopher, HTTP, FTP, WAIS, and NNTP servers. Current versions of Lynx run on Unix, VMS, Windows 95/NT, 386DOS and OS/2 EMX.

share|improve this answer
add comment

I wrote a small application to allow you to do a Google search via CLI, it is actually very simple and currently only supports Web search, Images search and News search.

Codename: Gisele

$ php gisele.phar web -m 5 "stackoverflow"
1) Stack Overflow - http://stackoverflow.com/
2) Ask Question - http://stackoverflow.com/users/login
3) Stack overflow - Wikipedia, the free encyclopedia - http://en.wikipedia.org/wiki/Stack_overflow
4) Blog Stack Exchange - http://blog.stackexchange.com/
5) StackOverflow - IT Conversations - The Conversations Network - http://itc.conversationsnetwork.org/series/stackoverflow.html
share|improve this answer
add comment

If you're willing to sign up for a Google API key, you should be able to use the Net::Google Perl module in tandem with the Google SOAP API to do this. See here and here for simple perl scripts that use Net::Google.

You can also use the less specialised SOAP::Lite perl module for this task.

Alternatively, you can screen scrape Google queries via WWW::Mechanize, Web::Scraper or one of the many Perl screen-scraping modules, if you aren't disturbed by it's nebulous legal standing. Here's a good tutorial to get you started.

A command-line tool like this might work well when combined with a browser like Uzbl to provide a fast browsing experience.

share|improve this answer
add comment

You can use a terminal browser like Elinks, which allows you to browse the web in the terminal and optionally open a link in another browser, like Firefox.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.