Twitter update from terminal (pok3's snipts ?)

curl -u YourUsername:YourPassword -d status="Your status message go here" http://twitter.com/statuses/update.xml
Found it on snipt, pok3, is it yours? I put my user = m33600, the password and the status was my robot message: Settima robot message: ALARM ZONE 3 (sent via command line). Now bots may have their identity on twitter...
Sample Output
<?xml version="1.0" encoding="UTF-8"?>
<status>
  <created_at>Sat Jun 27 21:33:19 +0000 2009</created_at>
  <id>2363785326</id>
  <text>Settima robot message: ALARM ZONE 03 (sent via command line)</text>
  <source>web</source>
  <truncated>false</truncated>
  <in_reply_to_status_id></in_reply_to_status_id>
  <in_reply_to_user_id></in_reply_to_user_id>
  <favorited>false</favorited>
  <in_reply_to_screen_name></in_reply_to_screen_name>
  <user>
    <id>9982902</id>
    <name>m33600</name>
    <screen_name>m33600</screen_name>
    <location></location>
    <description></description>
    <profile_image_url>http://static.twitter.com/images/default_profile_normal.png</profile_image_url>
    <url></url>
    <protected>false</protected>
    <followers_count>4</followers_count>
    <profile_background_color>9ae4e8</profile_background_color>
    <profile_text_color>000000</profile_text_color>
    <profile_link_color>0000ff</profile_link_color>
    <profile_sidebar_fill_color>e0ff92</profile_sidebar_fill_color>
    <profile_sidebar_border_color>87bc44</profile_sidebar_border_color>
    <friends_count>3</friends_count>
    <created_at>Tue Nov 06 00:18:20 +0000 2007</created_at>
    <favourites_count>0</favourites_count>
    <utc_offset>-10800</utc_offset>
    <time_zone>Greenland</time_zone>
    <profile_background_image_url>http://static.twitter.com/images/themes/theme1/bg.gif</profile_background_image_url>
    <profile_background_tile>false</profile_background_tile>
    <statuses_count>10</statuses_count>
    <notifications>false</notifications>
    <verified>false</verified>
    <following>false</following>
  </user>
</status>

2
By: m33600
2009-06-27 21:47:48

6 Alternatives + Submit Alt

What Others Think

How would I avoid revealing my password to ps?
kaedenn · 482 weeks ago
Nifty. I'll use this for my Nagios monitor. Thanks.
Scott · 481 weeks and 6 days ago
@kaedenn: Take a look at the --netrc option in man curl. See also man netrc. (not tested)
dennisw · 481 weeks and 6 days ago
I wrapped this into a shell script that asks for your username, then password, then message and then sends it to twitter. I would like some help, if anyone knows, in verifying whether the message actually gets sent or not and then returning that info to the command line. Anyone interested in the command, let me know and I will post it here.
dilbert4life · 481 weeks and 5 days ago
If you ommit the password, it will be asked by the curl command interactevely. In this way you can hide the passwd. curl -u user -d status="Tweeting from the shell" http://twitter.com/statuses/update.xml
mdelatorre · 481 weeks and 1 day ago
I d like to improve it to receive the status messaage form stdin, as a variable, so other programs may send info to twitter. As an example " Temperature in my room is %T now"
m33600 · 480 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: