I was scrubbing the internets a few nights ago and stumbled upon a way to Tweet from the Terminal. Here is a simple way to get started. Please note this method is not the most secure, since you have to hard code a script with your user / pass.
How To Use Twitter from Terminal
1. In Terminal type: curl -u username:password -d status="message" http://twitter.com/statuses/update.xml
obviously change your user/pass and replace message with your tweet.
Now lets create a file to call that a bit quicker…
2. Open a text editor, type the following code and save it as twitter.sh (or whatever you prefer just make sure it ends in .sh):
#!/bin/bash
curl -u username:password -d status="$1" http://twitter.com/statuses/update.xml
3. I dropped this script in my home directory ~
4. Change the chmod to 777, type the following in Terminal:
chmod 777 /path/to/twitter.sh
Now you can just type: ./path/to/twitter.sh "Message"
replacing message with your tweet.
But we can still make it easier!
5. In terminal type: alias twitter=”/path/to/the/file/twitter.sh $1?
this creates an alias to make tweeting from terminal easier. Also feel free to change alias twitter to any other alias you wish (twit, tw, tweet, etc).
Now you can type this in the Terminal: twitter "whatever you teet is"
Another helpful hint…
If you have multiple accounts on Twitter like I do. You can make a few different files – see step #2. Make sure to save each one with a different name. Also don’t forget to create additional aliases for these files. (My aliases are twwi, twtf, twrb).
Matt is a Systems Development Director for a multinational franchise. Matt has lived and worked in Hawaii, Chicago, South Florida and currently resides outside of Atlanta. He enjoys his hobbies including Technology, Gadgets/EDC, Fountain Pens, Wetshaving, Clocks, Antiques & Coffee. He even roasts his own coffee weekly.