Tweet from linux command-line
July 28, 2009
Hello there
you should read this post if you’re a Twitter fan
today I read a tutorial about “Tweeting from your Linux Desktop“
sounds interesting huh?!
okay lets figure out how to do that:
Create a bash script file (Example: Twitter.sh) in your home directory
then write this data into it:
#########################################
#!/bin/bash
USERNAME=”your-mail-or-username”
PASSWORD=”your-password”URL=http://twitter.com/statuses/update.xml
result=`curl -u $USERNAME:$PASSWORD -d status=”Hello, i’m Tweeting from my linux command line” $URL`
exit 0
#########################################
you can also use it as a simple command by adding an alias to the “.bash_profile” file in your home directory
lets try it:
modify your script to be like this:
#########################################
#!/bin/bash
USERNAME=”your-mail-or-username”
PASSWORD=”your-password”URL=http://twitter.com/statuses/update.xml
result=`curl -u $USERNAME:$PASSWORD -d status=”$1″ $URL`
exit 0
#########################################
then go to your home directory:
#cd ~
then:
#gedit .bash_profile
and add this line to the file:
alias twitter=’/home/your-username/Twitter.sh’
now you can use this command:
#twitter “Hello all, i’m tweeting from my command line”
——————————————————————-
you can find more in the Original post
Have fun

July 28, 2009 at 5:03 PM
i will try it isA
thanks
July 29, 2009 at 12:14 AM
I would use $@ instead of $1, so you can use it without quotes; ./twitter blah bleh bluh
July 29, 2009 at 3:16 AM
oh, that’d be much better
thanks
March 3, 2010 at 9:27 AM
Great script! Thanks for sharing – now I can let many things twit – like twit the latest git commit log to fellow team members following a “commits” notification twitter account – via a git post-update hook calling this modified script.
March 3, 2010 at 2:31 PM
thank you
and that’s a really good idea btw
June 14, 2010 at 11:48 PM
gr8 thnx for sharing
October 8, 2010 at 12:37 AM
Basic authentication is not supported
You must use Oauth for twitter now, so this method will no longer work as of mid-2010.