Twitter from Unix/Linux/OSX command line

Yep, you can. Here is the recipe:

1) You need to install “curl” for your OS. OSX comes with it by default which is nice. Most unices out there also have it installed or have it available for download (Ubuntu, Debian users can use “sudo apt-get install curl” to install).
2) Edit a text file using your favourite editor and add the following line in there:
curl --basic --user "youruserid:yourpassword" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json" -o /dev/null
3) Make sure you replace youruserid and yourpassword with appropriate strings.
4) Save the file as something like twitter.sh and make it executable by issuing this command:
chmod 700 ./twitter.sh
5) Twitter away by using the following command line:
./twitter.sh "Put your twit in here and press Enter"
6) Done.

Have fun commandline twittering :-).

Leave a Reply