Commands tagged google (68)

  • Usage: translate <phrase> <source-language> <output-language> Example: translate hello en es See this for a list of language codes: Show Sample Output

    translate(){ wget -qO- "$1&langpair=$2|${3:-en}" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1\n/'; }
    matthewbauer · 2010-03-08 03:15:48 19

    rtfm() { help [email protected] || man [email protected] || $BROWSER "[email protected]"; }
    hunterm · 2011-01-05 02:53:38 7
  • Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with. Download it here: Manual: This specific command courtesy of lifehacker: Though all can be found in manual page linked above. Show Sample Output

    google docs edit --title "To-Do List" --editor vim
    spiffwalker · 2010-06-21 16:15:42 3
  • EDIT: command updated to support accented characters! Works in any of 58 google supported languages (some sound like crap, english is the best IMO). You get a mp3 file containing your query in spoken language. There is a limit of 100 characters for the "q" parameter, so be careful. The "tl" parameter contains target language.

    wget -q -U Mozilla -O output.mp3 "
    sairon · 2011-03-08 14:05:36 12
  • This function takes a word or a phrase as arguments and then fetches definitions using Google's "define" syntax. The "nl" and perl portion isn't strictly necessary. It just makes the output a bit more readable, but this also works: define(){ local y="[email protected]";curl -sA"Opera" "${y// /+}"|grep -Po '(?<=<li>)[^<]+';} If your version of grep doesn't have perl compatible regex support, then you can use this version: define(){ local y="[email protected]";curl -sA"Opera" "${y// /+}"|grep -Eo '<li>[^<]+'|sed 's/<li>//g'|nl|perl -MHTML::Entities -pe 'decode_entities($_)' 2>/dev/null;} Show Sample Output

    define(){ local y="[email protected]";curl -sA"Opera" "${y// /+}"|grep -Po '(?<=<li>)[^<]+'|nl|perl -MHTML::Entities -pe 'decode_entities($_)' 2>/dev/null;}
    eightmillion · 2010-01-29 05:01:11 5
  • Usage examples: say hello say "hello world" say hello+world

    say() { mplayer "$1"; }
    daa · 2011-09-08 03:34:24 2
  • Usage: t2s 'How are you?' Nice because it automatically names the mp3 file up to 15 characters Modified (uses bash manip instead of tr) t2s() { wget -q -U Mozilla -O $(cut -b 1-15

    t2s() { wget -q -U Mozilla -O $(tr ' ' _ <<< "$1"| cut -b 1-15).mp3 "$(tr ' ' + <<< "$1")"; }
    snipertyler · 2013-10-16 23:29:59 1
  • Put it in your ~/.bashrc usage: google word1 word2 word3... google '"this search gets quoted"' Show Sample Output

    function google { Q="[email protected]"; GOOG_URL=''; AGENT="Mozilla/4.0"; stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}${Q//\ /+}" | grep -oP '\/url\?q=.+?&amp' | sed 's|/url?q=||; s|&amp||'); echo -e "${stream//\%/\x}"; }
    michelsberg · 2013-04-05 08:04:15 2

  • 12
    say(){ mplayer -user-agent Mozilla "$(echo $* | sed 's#\ #\+#g')" > /dev/null 2>&1 ; }
    return13 · 2011-03-13 21:10:26 1
  • This microscript looks up a man page for each word possible, and if the correct page is not found, uses w3m and Google's "I'm feeling lucky" to output a first possible result. This script was made as a result of an idea on a popular Linux forum, where users often send other people to RTFM by saying something like "man backup" or "man ubuntu one". To make this script replace the usual man command, save it as "" in your home folder and add the following string to the end of your .bashrc file: alias man='~/' Show Sample Output

    /usr/bin/man $* || w3m -dump"$*"\&btnI | less
    d1337r · 2010-10-05 13:51:39 0
  • Some commands have more information on 'info' than in the man pages

    rtfm() { help [email protected] || info [email protected] || man [email protected] || $BROWSER "[email protected]"; }
    seattlegaucho · 2011-01-05 21:26:51 1
  • I found this command on a different site and thought you guy might enjoy it. Just change "YOURSEARCH" to what ever you want to search. Example, "Linux Commands"

    Q="YOURSEARCH"; GOOG_URL=""; AGENT="Mozilla/4.0"; stream=$(curl -A "$AGENT" -skLm 10 "${GOOG_URL}\"${Q/\ /+}\"" | grep -oP '\/url\?q=.+?&amp' | sed 's/\/url?q=//;s/&amp//'); echo -e "${stream//\%/\x}"
    techie · 2013-04-03 09:56:41 5
  • allow multiword translations Show Sample Output

    translate() { lng1="$1";lng2="$2";shift;shift; wget -qO- "${@// /+}&langpair=$lng1|$lng2" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1\n/'; }
    bandie91 · 2010-05-02 22:15:30 5
  • This version works on Mac (avoids grep -P, adding a sed step instead, and invokes /usr/bin/perl with full path in case you have another one installed). Still requires that you install perl module HTML::Entities ? here's how:

    define(){ local y="[email protected]";curl -sA"Opera" "${y// /+}"|grep -Eo '<li>[^<]+'|sed 's/^<li>//g'|nl|/usr/bin/perl -MHTML::Entities -pe 'decode_entities($_)';}
    gthb · 2010-01-30 13:08:03 1
  • I took matthewbauer's cool one-liner and rewrote it as a shell function that returns all the suggestions or outputs "OK" if it doesn't find anything wrong. It should work on ksh, zsh, and bash. Users that don't have tee can leave that part off like this: spellcheck(){ typeset [email protected];curl -sd "<spellrequest><text>$y</text></spellrequest>"|sed -n '/s="[1-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}';} Show Sample Output

    spellcheck(){ typeset [email protected];curl -sd "<spellrequest><text>$y</text></spellrequest>"|sed -n '/s="[0-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}'|tee >(grep -Eq '.*'||echo -e "OK");}
    eightmillion · 2010-02-17 08:20:48 5
  • Use curl and sed to shorten an URL using without any other api Show Sample Output

    curl -s -d'&url=URL' | sed -e 's/{"short_url":"//' -e 's/","added_to_history":false}/\n/'
    Soubsoub · 2010-10-01 23:20:08 2
  • substitute "example" with desired string; tl = target language (en, fr, de, hu, ...); you can leave sl parameter as-is (autodetection works fine) Show Sample Output

    wget -U "Mozilla/5.0" -qO - "" | sed 's/\[\[\[\"//' | cut -d \" -f 1
    sairon · 2011-03-06 13:46:16 0
  • Shorter and made into a function. Show Sample Output

    googl () { curl -s -d "url=${1}" | sed -n "s/.*:\"\([^\"]*\).*/\1\n/p" ;}
    dabom · 2010-10-03 02:52:44 0
  • Sometimes you don't have man pages only '-h' or '--help'.

    rtfm() { help [email protected] || [email protected] -h || [email protected] --help || man [email protected] || $BROWSER "[email protected]"; }
    karol · 2011-01-05 17:36:26 0
  • same but redirecting to player and putting whaever text line.. works on my ubuntu machine ...

    p=$(echo "hello world, how r u?"|sed 's/ /+/g');wget -U Mozilla -q -O - "[email protected]"\&q=$p|mpg123 -
    jhansen · 2011-09-19 23:06:15 0
  • google has added 2 more netblocks... Show Sample Output

    for NETBLOCK in $(echo; do nslookup -q=TXT $NETBLOCK ; done | tr " " "\n" | grep ^ip[46]: | cut -d: -f2- | sort
    emphazer · 2019-12-16 07:09:12 19
  • use curl and sed to shorten an url via

    curl -s ''"$1" | sed -e 's/{"short_url":"//' -e 's/"}/\n/g'
    mvrilo · 2010-03-26 22:31:06 4
  • The FLAC audio must be encoded at 16000Hz sampling rate (SoX is your friend). Outputs a short JSON string, the actual speech is in the hypotheses->utterance, the accuracy is stored in hypotheses->confidence (ranging from 0 to 1). Google also accepts audio in some special speex format (audio/x-speex-with-header-byte), which is much smaller in comparison with losless FLAC, but I haven't been able to encode such a sample. Show Sample Output

    wget -q -U "Mozilla/5.0" --post-file speech.flac --header="Content-Type: audio/x-flac; rate=16000" -O - ""
    sairon · 2011-03-08 13:39:01 0
  • Usage: google "[search string]" Example: google "something im searching for" This will launch firefox and execute a google search in a new tab with the provided search string. You must provide the path to your Firefox binary if using cygwin to $ff or create an alias like follows: alias firefox='/cygdrive/c/Program Files (x86)/Mozilla Firefox/firefox.exe' Most Linux flavors with Firefox installed will use just ff="firefox" and even OSX.

    google() { gg=""; ff="firefox"; if [[ $1 ]]; then "$ff" -new-tab "$gg"$(echo ${1//[^a-zA-Z0-9]/+}); else echo 'Usage: google "[seach term]"'; fi }
    lowjax · 2013-08-01 22:21:53 5
  • This is a basis for other Google API commands.

    curl -s -d Email=$email -d Passwd=$password -d service=lh2 | grep Auth | sed 's/Auth=\(.*\)/\1/'
    matthewbauer · 2010-02-04 03:34:54 2
  •  1 2 3 > 

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Listing today’s files only

echo unicode characters

Mount a Windows share on the local network (Ubuntu) with user rights and use a specific samba user

Create a random file of a certain, and display progress along the way.
SIZE is the number of gigabytes and the file name is at the end. Random data is generated by encrypting /dev/zero, similar to other techniques posted on here.

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

List last opened tabs in firefox browser
Tuned for short command line - you can set the path to sessionstore.js more reliable instead of use asterixes etc. Usable when you are not at home and really need to get your actual opened tabs on your home computer (via SSH). I am using it from my work if I forgot to bookmark some new interesting webpage, which I have visited at home. Also other way to list tabs when your firefox has crashed (restoring of tabs doesn't work always). This script includes also tabs which has been closed short time before.

send file to remote machine and unzip using ssh
This version transfers gzipped data which is unzipped as it arrives at the remote host.

Check reverse DNS
I'm just a simple programmer. I find dig too verbose. host tells me alias(es) and IP address in a quick to grok format with nothing special to remember for input parameters. With thanks to

Display the standard deviation of a column of numbers with awk

BASH: Print shell variable into AWK

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: