How to post to Twitter from the Linux command line [SimpleHelp]

via Simple Help by Sukrit Dhandhania on 4/6/09

Linux

Twitter has become a big part the online lives of a lot of people in the recent months. Although in itself Twitter is a pretty simple service, which makes it easy for just about everyone to use it, it ships with an API which has helped people port it to just about every platform. Twitter has been ported to web browsers, to cellphones, and apparently even washing machines haven’t been spared. The Linux command line has always been a favorite of geeks. Here’s a trick that’s great fun, and could be useful if required.

Let’s see how to post an update to your Twitter account right from the Linux command line. This will also work on the MacOS X command line. Enter the following command in your terminal interface, replacing username and password with your Twitter account credentials, and status="Tweeting from the Linux command line" with your own message.

# curl -u username:password -d status="Tweeting from the Linux command line" http://twitter.com/statuses/update.xml > /dev/null

So if your Twitter username is fuzzycat17 and you password is fur123ball the above command will look like this:

# curl -u fuzzycat17:fur123ball -d status="Tweeting from the Linux command line" http://twitter.com/statuses/update.xml > /dev/null

Running this command will result in a new Tweet being posted from your account containing the words Tweeting from the Linux command line

Now go check your Twitter home page to see if the Tweet was posted correctly.

As I said, this trick could be completely for geekish fun, or could be put to good use. You could integrate this command into shell script to notify you of something.

Happy Tweeting.

---
Related Articles at Simple Help:


How to post to Twitter from the Linux command line - Simple Help

by Ben Pike