Categories
Linux

Twittering from the Command Line

Since I’ve started using Twitter, I’ve been on the hunt for a command line version, so I don’t need to start up a browser or send an SMS on my phone. As I found out, it’s pretty darn easy to Twitter from the command line.

In Ubuntu, install curl with apt-get install curl, then create a file paste the line below into it, modify the username and password strings:
curl --basic --user "username:password" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json"
Save or copy the file into /usr/bin, and you’re done.

And then you can do something fun like this:

Twitter Command Line Interface CLI for Linux

The result is equally tasty:

Twitter Command Line Interface CLI for Linux

I’m brainstorming a few strange uses for this, something like setting up tweet notifications of long-running batch jobs that finally finish. Or this might be a good way to prank someone, just have a cron job running that spits out random logfile garbage every few days… LOL. You guys got any other ideas?