Update twitter from command line!

Are a command line freak like me! ever wanted to tweet from commanline ? Don worry Commandline Fu has the answer..

First you’ll need to have curl command in your path. if you don have install it by sudo apt-get install curl on ubuntu.

You ‘ll need to put a line “machine twitter.com login TWITTERUSER password TWITTERPASS” in $HOME/.netrc and better chmod 600 that file.

Then use this command.

$ curl -n -d status='Hello from cli' https://twitter.com/statuses/update.xml

Thanks Commandlinefu.com

Update :

A script version without netrc dependence (also prevents blank status updates): thanks Dan
#!/bin/sh
# usage: ./update.sh STATUS
if [ “x${1}” != “x” ]; then
curl -u twitterid:password -d “status=${1}” https://twitter.com/statuses/update.xml
fi

Advertisements

4 thoughts on “Update twitter from command line!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s