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 ' ' '+'`" ""
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?

21 replies on “Twittering from the Command Line”

The cron job could access /usr/games/fortune and then you could build fortune databases for different twitterbox pranks^h^h^h^h^h^happlications.

Of course with cron, the regularity would eventually be noted. You could put a random delay in the cron script that calls curl.

call it “critter”

How about posting everything you play on to Twitter? I’m sure it wouldn’t be hard to get it up to say “I just played _ by _” every time you play something new.

Though I dislike anything that makes me store my username/password in cleartext anywhere, it still indeed is a great idea.
Can also be used as a calendar application, tweeting at the right times, which in turn alerts u on phone..
ofcourse google calendar provides that anyways..

Am I the only person who thinks twitter is a waste of time? Don’t get me wrong, I love all things geeky… but I really couldn’t give a **** when my friends are feeding their cats or peering out of the window.

P.S. Thanks for the heads up on virtual box, the latest VMware was terrible and virtual box has been amazing – given your experience with virtual box have you ever moved a virtual machine onto physical hardware? I would like to setup a machine before copying the image onto a new piece of HW.

@Paul: Heading over to ur blog

@Ian: I’m a fan of “true” laziness (I read that term somewhere recently, dont remember where), i.e. to automate/reduce steps in anything you can. But yes, I hear what you say about twitter. I just don’t get it. But anyways, I don’t get a lot of things in this world, and 90% of them are supercool, 10% are superduds (again, am I right in this?). So, twitter might fall into anyone of these, and I might not even know. bah, am thinking too much, time for a nap to get rest for all this effort that I just did 🙂

You have the start of something interesting here. Perhaps you might like to cast your script a bit more in the “unix” style by making it print something only if anything goes wrong. curl’s –silent parameter can help, as well as shell redirection.

Wow! Awesome tip.

@Ian Fuller@ – you’re right when people use twitter that way it’s a whole waste of time. But we’re much smarter than that here (I hope). For example, I’ve set up twitter with Remember the Milk…it reminds me of stuff I need to do through my phone and I can add stuff to my tasklist via twitter through my phone…although I haven’t actually tried that.

Question!!!! I ran did all this, and twittered. But, After twittering, I get a whole bunch of text printed before my prompt. Just checking to see if its normal?

Great – I should certainly pronounce, impressed with your web site. I had no trouble navigating through all the tabs and related information ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, web site theme . a tones way for your customer to communicate. Nice task.

Leave a Reply

Your email address will not be published. Required fields are marked *