Twit from command line (Linux)

Here is a thing that i found during searching for a completely different things, you can update your Twitter status simply by using curl which is most of the time installed by default so here is the command

/usr/bin/curl -u username:password -d status="your tweet"

it simply updates your twitter status, this is extremely simple and could easily be used to update status, but the problem is that it contains your password and you dont want to display your password so you can make a simple script for it which asks you for the tweet and displays if successful or not

echo Post your tweet.......
read tweet
`/usr/bin/curl -u <username>:<password> -d status="$tweet"`
if [[ "$?" == 0 ]];
echo Updated successfuly!!!!
exit 0
echo Something went wrong try again!!!!
exit 1

to make it just login as root by ‘sudo -i’ or ‘su’ and type gedit /usr/local/bin/twit now paste the script and replace <username> and <password> with username and password of your twitter account and save the file, we will change the permissions for the file and make it executable by typing chmod +x /usr/local/bin/twit all done now when you want to twit just type twit on command line and let the world know what you are doing.

PS:- if you are on twitter feel free to add me

Published: December 04 2007

  • category:
  • tags:
blog comments powered by Disqus