Post to Twitter using the command line
File this one squarely in the "because we can," category, but the Digital Streets blog has a tip for command line junkies who want to update Twitter without opening a web browser or a 3rd party application. All you need to do is install cURL, a command line utility for Linux, Windows or OS X and then send a message to Twitter with your status updates.
In Ubuntu, here's how to install cURL:
It's up to you to figure out why you would actually want to do this, but now you can.
In Ubuntu, here's how to install cURL:
- Open a terminal
- Type "sudo apt-get install curl" (without the quotes)
- Enter your root password when prompted
It's up to you to figure out why you would actually want to do this, but now you can.













Comments
7
Subscribe to commentspierfrancesco99Mar 8th 2008 7:51AM
How can install cURL and use in Windows XP ?
Brad LinderMar 8th 2008 7:54AM
Try downloading cURL from this link:
http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000%2FXP
RazorDMar 8th 2008 7:56AM
I wrote a perl script to do this too, its open source on google code (http://code.google.com/p/gmedtwitpost/)
you setup the username and password in the script and then just run 'gmedtwitpost.pl new_status' and it'll update.
SaulMar 8th 2008 12:28PM
I blogged about doing this from the shell on the mac - using launchbar - it's darm easy, and works great
http://saulrosenbaum.com/blog/2007/10/16/the-raw-power-of-launchbar-shell/
Grant RobertsonMar 8th 2008 12:57PM
That is totally hot. Rawk!
Alex GretleinMar 9th 2008 8:21AM
Of course you would want to alias this with something like:
alias twit='curl -u yourusername:yourpassword -d status="$1" http://twitter.com/statuses/update.xml'
(preferably in your .bashrc or the like) and then you could just do "twit Message".
I'm not sure if KDE's Katapult or GNOME's Deskbar Applet recognize your Bash aliases. If they do, then you could use this to twit from either. (In Katapult type "exec" first.) If they don't, then just use Saul's tip and save it as a script in your path, and you'll be good to go in either. (There are also several Twitter plugins for Deskbar. I'm not sure if they do anything more than send messages, for which it seems curl is perfect.)
Lastly, you don't need to download curl, wget (installed by default on many *nix systems) should be fine:
wget -O - --user=USER --password=PASSWORD --post-data='status="MESSAGE"' http://twitter.com/statuses/update.xml
arrohwanyMar 12th 2008 10:15PM
Very great idea :0
i like it...