How To: Update twitter Status using Linux Command Line




Command Line

twitter logo$ 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.
Install Curl
sudo apt-get install curl
  • 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.
tweet function
tweet(){ curl -u “$1″ -d status=”$2″ “http://twitter.com/statuses/update.xml”; }
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.
update your twitter status
tweet       your_username     your_new_status
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-
edit .bashrc
sudo gedit ~/.bashrc
Paste the tweet() function at the bottom of this page.
tweet function
tweet(){ curl -u “$1″ -d status=”$2″ “http://twitter.com/statuses/update.xml”; }
And reload .bashrc file to make changes to happen.
reload .bashrc
sudo source  ~/.bashrc
And it is permanent now!

Will share some more Linux command line functions in my next post.
ENJOY !

You can Subscribe to TechTickle Feed or join us on our Facebook Page or follow us on twitter for any queries and to keep yourself updated with the latest updates!

  • Share/Bookmark

You might like:

Enter your email address:

Delivered by FeedBurner


About - Mani

Mani is a coder passionate about working in open-source projects. You can follow him on Twitter . If You have any questions feel free to write and add him to Gtalk - it will be nice to get comments and direct contact from you!

One Comment | Add your own!

  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 [...]

Leave a Comment