
Terminal - Commands tagged curl - 149 results
findlocation() { place=`echo $1 | sed 's/ /%20/g'` ; curl -s "http://maps.google.com/maps/geo?output=json&oe=utf-8&q=$place" | grep -e "address" -e "coordinates" | sed -e 's/^ *//' -e 's/"//g' -e 's/address/Full Address/';}
This is sample output - yours may be different.
shadyabhi@ArchLinux ~ $ findlocation DA-IICT
Full Address: Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar, Gujarat, India,
coordinates: [ 72.6276828, 23.1891000, 0 ]
shadyabhi@ArchLinux ~ $ findlocation "DA-IICT Gandhinagar"
Full Address: Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar, Gujarat, India,
coordinates: [ 72.6276828, 23.1891000, 0 ]
shadyabhi@ArchLinux ~ $
Just add this to your .bashrc file.
Use quotes when query has multiple word length.
for url in `cat urls `; do title=`curl $url 2>&1 | grep -i '<title>.*</title>'` && curl $url > /tmp/u && mail -s "$title" your-private-instapaper-address@instapaper.com < /tmp/u ; done
This is sample output - yours may be different.
Note, you need to replace the email address with your private Instapaper email address.
There are a bunch of possible improvements such as,
- Not writing a temp file
- Doesnt strip tags (tho Instapaper does thankfully)
- Shouldnt require 2 curls
This is sample output - yours may be different.
Check the Description below.
This is sample output - yours may be different.
The command was too long for the command box, so here it is:
echo $(( `wget -qO - http://i18n.counter.li.org/ | grep 'users registered' | sed 's/.*\<font size=7\>//g' | tr '\>' ' ' | sed 's/<br.*//g' | tr ' ' '\0'` + `curl --silent http://www.dudalibre.com/gnulinuxcounter?lang=en | grep users | head -2 | tail -1 | sed 's/.*<strong>//g' | sed 's/<\/strong>.*//g'` ))
This took me about an hour to do. It uses wget and curl because, dudalibre.com blocks wget, and wget worked nicely for me.
shout() { curl -s "http://shoutkey.com/new?url=${1}" | sed -n "/<h1>/s/.*href=\"\([^\"]*\)\".*/\1/p" ;}
This is sample output - yours may be different.
http://shoutkey.com/multiple
shout () { curl -s "http://shoutkey.com/new?url=$1" | sed -n 's/\<h1\>/\&/p' | sed 's/<[^>]*>//g;/</N;//b' ;}
This is sample output - yours may be different.
$ shout http://www.commandlinefu.com
remind
Just add this function to your .zshrc / .bashrc, and by typing "shout *URL*" you get a randomly chosen English word that ShoutKey.com uses to short your URL. You may now go to shoutkey.com/*output_word* and get redirected. The URL will be valid for 5 minutes.
(I've never used sed before, so I'll be quite glad if someone could straighten up the sed commands and combine them (perhaps also removing the whitespace). If so, I'll update it right away ;) )
curl -n --ssl-reqd --mail-from "<user@gmail.com>" --mail-rcpt "<user@server.tld>" --url smtps://smtp.gmail.com:465 -T file.txt
This is sample output - yours may be different.
Required curl version >=7.21; using .netrc for authorization
googl () { curl -s -d "url=${1}" http://goo.gl/api/url | sed -n "s/.*:\"\([^\"]*\).*/\1\n/p" ;}
This is sample output - yours may be different.
Shorter and made into a function.
curl -s -d'&url=URL' http://goo.gl/api/url | sed -e 's/{"short_url":"//' -e 's/","added_to_history":false}/\n/'
This is sample output - yours may be different.
curl -s -d'&url=www.google.com' http://goo.gl/api/url | sed -e 's/{"short_url":"//' -e 's/","added_to_history":false}/\n/'
http://goo.gl/fbsS
Use curl and sed to shorten an URL using goo.gl without any other api
imageshack() { for files in *; do curl -H Expect: -F fileupload="@$files" -F xml=yes -# "http://www.imageshack.us/index.php" | grep image_link | sed -e 's/<image_link>/[IMG]/g' -e 's/<\/image_link>/[\/IMG]/g'; done; }
This is sample output - yours may be different.
[user@host ~]$ imageshack
######################################################################## 100.0%
[IMG]http://img541.imageshack.us/img541/5382/wifidock01.png[/IMG]
######################################################################## 100.0%
[IMG]http://img716.imageshack.us/img716/54/wifidock02.png[/IMG]
######################################################################## 100.0%
[IMG]http://img825.imageshack.us/img825/6664/wifidock03.jpg[/IMG]
Each file in the current folder is uploaded to imageshack.us
If the folder contains other filetypes
change:
for files in *
to:
for files in *.jpg
(to upload ONLY .jpg files)
Additionally you can try (results may vary):
for files in *.jpg *.png
The output URL is encased with BB image tags for use in a forum.
check(){ curl -sI $1 | sed -n 's/Location: *//p';}
This is sample output - yours may be different.
curl -s http://urlxray.com/display.php?url=http://tinyurl.com/demo-xray | grep -o '<title>.*</title>' | sed 's/<title>.*--> \(.*\)<\/title>/\1/g'
This is sample output - yours may be different.
http://urlxray.com/sex-so-hot-it-will-blow-your-mind.php
(Note: this result is totally SFW)
We can put this inside a function:
fxray() { curl -s http://urlxray.com/display.php?url="$1" | grep -o '<title>.*</title>' | sed 's/<title>.*--> \(.*\)<\/title>/\1/g'; };
fxray http://tinyurl.com/demo-xray
eog `curl -s http://xkcd.com/ | sed -n 's/<h3>Image URL.*: \(.*\)<\/h3>/\1/p'`
This is sample output - yours may be different.
xdg-open http://xkcd.com/
This is sample output - yours may be different.
KISS
To get a random xkcd comic:
xdg-open http://dynamic.xkcd.com/random/comic/
xkcd() { wget -qO- http://xkcd.com/ | sed -n 's#^<img src="\(http://imgs.[^"]\+\)"\s\+title="\(.\+\?\)"\salt.\+$#eog "\1"\necho '"'\2'#p" | bash ; }
This is sample output - yours may be different.
This function displays the latest comic from xkcd.com. One of the best things about xkcd is the title text when you hover over the comic, so this function also displays that after you close the comic.
To get a random xkcd comic use the following:
xkcdrandom() { wget -qO- http://dynamic.xkcd.com/comic/random | sed -n 's#^<img src="\(http://imgs.[^"]\+\)"\s\+title="\(.\+\?\)"\salt.\+$#eog "\1"\necho '"'\2'#p" | bash; }
These are just a bit shorter than the ones eigthmillion wrote, however his version didn't work as expected on my laptop for some reason (I got the title-tag first), so these build a command which is executed by bash.
eog `curl 'http://xkcd.com/' | awk -F "ng): |</h" '/embedding/{print $2}'`
This is sample output - yours may be different.
Shorter version with curl and awk
gwenview `wget -O - http://xkcd.com/ | grep 'png' | grep '<img src="http://imgs.xkcd.com/comics/' | sed s/title=\".*//g | sed 's/.png\"/.png/g' | sed 's/<img src=\"//g'`
This is sample output - yours may be different.
[hunterm@saturn ~ )> gwenview `wget -O - http://xkcd.com/ | grep 'png' | grep '<img src="http://imgs.xkcd.com/comics/' | sed s/title=\".*//g | sed 's/.png\"/.png/g' | sed 's/<img src=\"//g'`
--2010-08-24 18:20:34-- http://xkcd.com/
Resolving xkcd.com... 72.26.203.99
Connecting to xkcd.com|72.26.203.99|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7654 (7.5K) [text/html]
Saving to: ?STDOUT?
100%[=======================================================================================================================>] 7,654 --.-K/s in 0.08s
2010-08-24 18:20:34 (99.0 KB/s) - written to stdout [7654/7654]
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
gwenview(13369)/kdeui (kdelibs): Attempt to use QAction "edit_redo" with KXMLGUIFactory!
gwenview(13369)/kdeui (kdelibs): Attempt to use QAction "edit_undo" with KXMLGUIFactory!
gwenview(13369)/kio (KIOJob) KIO::TransferJob::slotMimetype: mimetype() emitted again, or after sending first data!; job URL = KUrl("http://imgs.xkcd.com/comics/i_dont_want_directions.png")
gwenview(13369)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing "/usr/share/mime/magic"
gwenview(13369)/kdecore (services) KMimeTypeFactory::parseMagic: Now parsing "/home/hunterm/.local/share/mime/magic"
gwenview(13369)/kdecore (KConfigSkeleton) KCoreConfigSkeleton::writeConfig:
Output the html from xkcd's index.html, filter out the html tags, and then view it in gwenview.
curl -sL 'www.commandlinefu.com/commands/random' | awk -F'</?[^>]+>' '/"command"/{print $2}'
This is sample output - yours may be different.
Splitting on tags in awk is a handy way to parse html.
curl -L -s `curl -s [http://podcast.com/show.rss]` | xmlstarlet sel -t -m "//enclosure[1]" -v "@url" -n | head -n 1` | ssh -t [user]@[host] "mpg123 -"
This is sample output - yours may be different.
Gets the latest podcast show from from your favorite Podcast. Uses curl and xmlstarlet.
Make sure you change out the items between brackets.
curl -L -s `curl -s http://www.2600.com/oth-broadband.xml` | xmlstarlet sel -t -m "//enclosure[1]" -v "@url" -n | head -n 1` | ssh -t [user]@[host] "mpg123 -"
This is sample output - yours may be different.
High Preformance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2 and 3.
Version 0.59s-mh4 (2000/Oct/27). Written and copyrights by Michael Hipp.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Playing MPEG stream from standard input ...
Found new ID3 Header
MPEG 2.0 layer III, 64 kbit/s, 22050 Hz joint-stereo
Ever wanted to stream your favorite podcast across the network, well now you can.
This command will parse the iTunes enabled podcast and stream the latest episode across the network through ssh encryption.
FOR /f %%g in ('echo %1 ^| iconv -f gbk -t utf-8') DO curl -x proxy:port -u user:pass -d status=%%g -d source="cURL" http://twitter.com/statuses/update.xml
This is sample output - yours may be different.
Aside from curl one will need iconv windows binary since windows lacks a native utf-8 cli interface. In my case I need a proxy in China and iconv to convert gbk status string into utf-8. GnuWin32 is a good choice with loads of coreutils natively ported to Windows
"FOR /f" is the solution to pass iconv output to curl.
curl -s "http://www.socrata.com/api/views/vedg-c5sb/rows.json?search=Axelrod" | grep "data\" :" | awk '{ print $17 }'
This is sample output - yours may be different.
Query the Socrata Open Data API being used by the White House to find any employee's salary using curl, grep and awk.
Change the value of the search parameter (example uses Axelrod) to the name of any White House staffer to see their annual salary.
This is sample output - yours may be different.
Curl is not installed by default on many common distros anymore. wget always is :)
wget -qO- ifconfig.me/ip
lynx --dump icanhazip.com
This is sample output - yours may be different.
If curl isn't available, use lynx.
This is sample output - yours may be different.
With a lolcat favicon if you access it from your browser