How To: Update twitter Status using Linux Command Line

Posted by Mani On February - 8 - 2010

Command Line

twitter logo header How To: Update twitter Status using Linux Command Line$ twitter user  my_new_status
>>  ….awaiting respose from twitter
>>  ….connected
>>  ….updating status to my_new_status
>>  ….done

Wondering what’s happening?
Here your twitter status is updated using Linux command line! Isn’t that cool? Commands really drive me crazy, and i have noticed, most of  us think that commands are bound to certain limits but that isnt the reality. You can do a lot of Geeky stuff, that you might have never thought about, by simply using your terminal.

For a beginner, it may seem little weird that one can update his/her status on a social website using command line (terminal) but, it is quite easy as well. It is quiet useful when you are dealing with slow connection.
Here is what we did to make that possible..
  • Open the terminal ( Alt+f2, and type gnome-terminal or simply go to Application -> Accessories -> Terminal).
You will get shell prompt as $ (if you’re a user other than root).
  • Now, you will need to install Curl package. Paste the command below in the terminal and hit ENTER.
[stextbox id="black" caption="Install Curl"]sudo apt-get install curl[/stextbox]
  • Now we will define a tweet () function. For this purpose simply use the function code given below ( NOTE that we are about to define our own custom command, pretty interesting right !)
Just copy the code below after $ and paste in the Terminal and hit ENTER.
[stextbox id="black" caption="tweet function"]tweet(){ curl -u “$1″ -d status=”$2″ “http://twitter.com/statuses/update.xml”; }[/stextbox]
You will get shell prompt $ again.
Now you have defined the tweet() function and you can use tweet command after this step.
Simply type this command in the terminal for updating your twitter status.
[stextbox id="black" caption="update your twitter status"]tweet       your_username     your_new_status [/stextbox]
It will ask for your twitter password. After giving password your twitter status will be updated.

NOTE – This command is temporary, it means it will vanish once you log out or  reboot.

If you want make it a permanent command, then simply open the .bashrc file and paste tweet() function in it. For this-
[stextbox id="black" caption="edit .bashrc"]sudo gedit ~/.bashrc[/stextbox]
Paste the tweet() function at the bottom of this page.
[stextbox id="black" caption="tweet function"]tweet(){ curl -u “$1″ -d status=”$2″ “http://twitter.com/statuses/update.xml”; }[/stextbox]
And reload .bashrc file to make changes to happen.
[stextbox id="black" caption="reload .bashrc"]sudo source  ~/.bashrc[/stextbox]
And it is permanent now!

Will share some more Linux command line functions in my next post.
ENJOY !
Suggested reading:
Share Any Webpage on Twitter with Tweet Button Bookmarklet
A few days ago, Twitter introduced its Official tweet button for websites to make their webpages Social Media Optimized. Just like TechTickle, many other websites who were relying on tweetmeme ...
READ MORE
Share your Stories with Twitter’s “Not So Unique” Twitter Tales
Undoubtedly, twitter is among the fastest growing Social Media websites. The micro blogging website allows you to stay in touch with friends, share whatever you like with others, promote your ...
READ MORE
After Who To Follow, Twitter Rolls out “You Both Follow”
Just a few days ago, twitter launched "who to follow" feature and then its official tweet button for website owners and users. Taking another step to make the world's best ...
READ MORE
Twitter’s Official Tweet Button: Another Step to Build Quality Following
Impressive, that's the word to describe the official tweet button from twitter. With the announcement note and a video that perfectly describes what the button is supposed to do, the ...
READ MORE
Twitter’s “Who to follow” Feature Helps you Follow Quality People
We have already discussed how difficult it can be to search like minded people on twitter. With millions of users on the popular micro blogging website, there are many quality ...
READ MORE
Customize and Theme-Up your Ubuntu Linux
A theme defines how various aspects of your system desktop appear. You may change the default wallpaper or use some desktop tools to make it look good, but that's not enough. A ...
READ MORE
How To Install Skype From Repositories in Ubuntu Linux
Skype is one of the popular, Voice Over Internet Protocol (VoIP) application that lets you make calls from one skype user to another skype user over the internet, free of ...
READ MORE
How to: Setup LAMP on Ubuntu
Web Server- To setup a web server and to run a website on a system(localhost) you have setup LAMP or WAMP first. If you are a Linux user, you have ...
READ MORE
Share Any Webpage on Twitter with Tweet Button
Share your Stories with Twitter’s “Not So Unique”
After Who To Follow, Twitter Rolls out “You
Twitter’s Official Tweet Button: Another Step to Build
Twitter’s “Who to follow” Feature Helps you Follow
Customize and Theme-Up your Ubuntu Linux
How To Install Skype From Repositories in Ubuntu
How to: Setup LAMP on Ubuntu

Article by

Mani is a coder passionate about working in open-source projects. You can follow him on Twitter or Join him on Facebook

Mani has written 30 articles for us at TechTickle.

2 Responses to “How To: Update twitter Status using Linux Command Line”

  1. [...] This post was mentioned on Twitter by Sahil Malhan, TechTickle. TechTickle said: Geeky Fun! TechTickLe.- "How To: Update @twitter Status using Linux Command Line http://bit.ly/cYeG7P " #twitter #linux #tutorials #terminal [...]

  2. Ed says:

    Mani, you do realize that this no longer works now that Twitter has dropped basic authentication correct?

Leave a Reply

About Me

Welcome to TechTickle! A blog that features Latest technology news, Linux tutorials, Updates related to Social Media, Website & Software reviews and Open Source. We are a group of ordinary individuals, with an extra ordinary quality of sharing our passion and, reaching out to the people in nook and corner. Read more About TechTickle!

Twitter

    Subscribe to E-mail Updates: