Commands tagged curl (212)

  • should be very consistent cause it's google :-)

    curl -s
    tuxilicious · 2010-04-04 01:22:59 6

  • 7
    curl[1-67].tar.gz -o phrack#1.tar.gz
    amaymon · 2009-08-21 10:14:25 4
  • This bash function uses to find the cover for an album. It returns an url to the image. Usage: albumart [artist] [album] These arguments can be reversed and if the album name is distinct enough, it may be possible to omit the artist. The command can be extended with wget to automatically download the matching image like this: albumart(){ local x y="$@";x=$(awk '/View larger image/{gsub(/^.*largeImagePopup\(.|., .*$/,"");print;exit}' <(curl -s ''${y// /+}'&itempage=1&newsearch=1&searchindex=Music'));[ -z "$x" ]&&echo "Not found."||wget "$x" -O "${y}.${x##*.}";} Show Sample Output

    albumart(){ local y="$@";awk '/View larger image/{gsub(/^.*largeImagePopup\(.|., .*$/,"");print;exit}' <(curl -s ''${y// /+}'&itempage=1&newsearch=1&searchindex=Music');}
    eightmillion · 2009-11-15 19:54:16 5

  • 7
    curl -s | awk -F'</?[^>]+>' '/\/intra\/trend\//{print $2}'
    putnamhill · 2009-12-22 01:01:02 6
  • 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="$@";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 12
  • This shell function grabs the weather forecast for the next 24 to 48 hours from Replace <YOURZIPORLOCATION> with your zip code or your "city, state" or "city, country", then calling the function without any arguments returns the weather for that location. Calling the function with a zip code or place name as an argument returns the weather for that location instead of your default. To add a bit of color formatting to the output, use the following instead: weather(){ curl -s "${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "\x1B[0;34m%s\x1B[0m: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';} Requires: perl, curl Show Sample Output

    weather(){ curl -s "${@:-<YOURZIPORLOCATION>}"|perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"';}
    eightmillion · 2010-02-10 01:23:39 11
  • Here is the full function (got trunctated), which is much better and works for multiple queries. function cmdfu () { local t=~/cmdfu; until [[ -z $1 ]]; do echo -e "\n# $1 {{{1" >> $t; curl -s "$1/`echo -n $1|base64`/plaintext" | sed '1,2d;s/^#.*/& {{{2/g' | tee -a $t > $t.c; sed -i "s/^# $1 {/# $1 - `grep -c '^#' $t.c` {/" $t; shift; done; vim -u /dev/null -c "set ft=sh fdm=marker fdl=1 noswf" -M $t; rm $t $t.c } Searches commandlinefu for single/multiple queries and displays syntax-highlighted, folded, and numbered results in vim. Show Sample Output

    cmdfu(){ local t=~/cmdfu;echo -e "\n# $1 {{{1">>$t;curl -s "$1/`echo -n $1|base64`/plaintext"|sed '1,2d;s/^#.*/& {{{2/g'>$t;vim -u /dev/null -c "set ft=sh fdm=marker fdl=1 noswf" -M $t;rm $t; }
    AskApache · 2012-02-21 05:43:16 10

  • 7
    curl -C - -o partially_downloaded_file ''
    weldabar · 2012-11-05 17:14:16 15
  • Share your "now playing" Amarok song in twitter!

    curl -u <user>:<password> -d status="Amarok, now playing: $(dcop amarok default nowPlaying)"
    caiosba · 2009-06-14 02:42:34 4
  • 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 y=$@;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 y=$@;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 15

  • 6
    eog `curl -s | sed -n 's/<h3>Image URL.*: \(.*\)<\/h3>/\1/p'`
    bluesman · 2010-08-31 13:23:21 2
  • 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 8

  • 6
    curl -I -H "Accept-Encoding: gzip,deflate"
    totti · 2011-08-16 10:32:01 2

  • 6
    drerik · 2012-08-16 05:45:03 5
  • tracing redirects for a given url shortener Show Sample Output

    curl --silent -I -L | grep -i location
    aysadk · 2022-09-04 19:31:46 485

  • 5
    curl -s | cowsay
    adaven · 2011-03-20 17:30:25 2
  • curl(1) is more portable than wget(1) across Unices, so here is an alternative doing the same thing with greater portability. This shell function uses curl(1) to show what site a shortened URL is pointing to, even if there are many nested shortened URLs. This is a great way to test whether or not the shortened URL is sending you to a malicious site, or somewhere nasty that you don't want to visit. The sample output is from: expandurl Show Sample Output

    expandurl() { curl -sIL $1 | grep ^Location; }
    atoponce · 2011-10-19 00:56:53 10

  • 5
    curl -s | awk -F'[:,]' '{print $7}'
    zlemini · 2013-07-28 00:31:30 5
  • Bash process substitution which curls the website '' and executes the shell script embedded in the page. This is obviously not the most secure way to run something like this, and we will scold you if you try. The smarter way would be: Download locally over SSL > curl >> Verify integrty with GPG (If available) > gpg --recv-keys 0xD2C4C74D8FAA96F5 > gpg --verify Inspect source code > less Run > chmod +x > ./

    sh <(curl
    lrvick · 2015-03-15 21:02:01 12

  • 4
    curl | tar zx
    mkoga · 2009-03-24 04:41:09 4

  • 4
    curl --form username=from_twitter --form password=from_twitter --form media=@/path/to/image --form-string "message=tweet"
    baergaj · 2009-04-27 15:57:04 9
  • identica is an open source social networking and micro-blogging service. Based on Laconica, a micro-blogging software package built on the OpenMicroBlogging specification.

    curl -u USER:PASS -d status="NEW STATUS"
    unixmonkey3754 · 2009-05-15 19:57:00 80
  • The curl command retrieve the HTML text containing the IP address. The grep command picks out the IP address from that HTML text. Show Sample Output

    curl -s | grep -Eo '[0-9\.]+'
    haivu · 2009-05-21 16:12:21 6
  • (Apparently it is too long so I put it in sample output, I hope that is OK.) Run the long command (or put it in your .bashrc) in sample output then run: fbemailscraper YourFBEmail Password Voila! Your contacts' emails will appear. Facebook seems to have gotten rid of the picture encoding of emails and replaced it with a text based version making it easy to scrape! Needs curl to run and it was made pretty quickly so there might be bugs. Show Sample Output

    fbemailscraper YourFBEmail Password
    dabom · 2010-01-31 00:44:35 29
  • Get your external ip adress thanks to

    curl -s
    thelan · 2010-04-03 11:11:34 3
  •  < 1 2 3 4 >  Last ›

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

Search through files, ignoring .svn
By putting the "-not \( -name .svn -prune \)" in the very front of the "find" command, you eliminate the .svn directories in your find command itself. No need to grep them out. You can even create an alias for this command: $ alias svn_find="find . -not \( -name .svn -prune \)" Now you can do things like $ svn_find -mtime -3

Find broken symlinks and delete them
If you don't want to delete them, but just want to list them, do $ find -L /path -type l If you want to delete them with confirmation first, do $ find -L /path -type l -exec rm -i {} + Using the -L flag follows symlinks, so the -type l test only returns true if the link can't be followed, or is a symlink to another broken symlink.

Check reverse DNS
The +short option should make dig less chatty.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

extract element of xml

Search commandlinefu from the command line
There's probably a more efficient way to do this rather than the relatively long perl program, but perl is my hammer, so text processing looks like a nail. This is of course a lot to type all at once. You can make it better by putting this somewhere: $ clf () { (curl -d "q=$@" 2>/dev/null) | egrep 'autocomplete|votes|destination' | perl -pi -e 's/$/\n\n/g;s/^ +|\([0-9]+ votes,//g;s/^\//http:\/\/\//g'; } Then, to look up any command, you can do this: $ clf diff This is similar to except that it's just one line, so more in the spirit of CLF, in my opinion.

Replace Every occurrence of a word in a file
Replace 'this' with 'that'

Want to known what time is it in another part of the world ?
available timezone can be found in /usr/share/zoneinfo. Other examples: $ TZ=Europe/Paris date; TZ=Australia/Sydney date; TZ=America/New_York date this is based on zoneinfo files on macosx. Your mileage my vary on other unix dialects

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

Get the Volume labels all bitlocker volumes had before being encrypted
Get information of volume labels of bitlocker volumes, even if they are encrypted and locked (no access to filesystem, no password provided). Note that the volume labels can have spaces, but only if you name then before encryption. Renaming a bitlocker partition after being encrypted does not have the same effect as doing it before.

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: