This one is for the command line junkies out there. By using cURL ( a client for getting files from servers), you can easily post your tweets to Twitter from the terminal window.

To install cURL:

  1. Open a terminal window.

  2. Execute the following Terminal command:
    sudo apt-get install curl
  3. Input the administrative password.

With cURL installed, you can post to Twitter from the terminal window by using the following syntax:

curl -u yourusername:yourpassword -d status=”Your Message Here” http://twitter.com/statuses/update.xml

You will receive a response containing the XML coding for your post which acts as a confirmation that your post was submitted.

24 Responses to “Ubuntu: Posting to Twitter from the Terminal Window”

  1. seamonkey420 Says:

    ohhh!.. thats just uber geeky. :P

  2. davak Says:

    Sweet! Totally will bump this up to the front in the next 24 hrs. Very nice.

  3. Alan Says:

    What the heck is “Twitter”?

  4. Paul Says:

    @Alan: http://www.youtube.com/watch?v=ddO9idmax0o

    Welcome to teh intarwebnets!

  5. chukaman Says:

    #!/bin/bash
    #

    USERNAME=
    PASSWORD=

    if [ $# != 1 ]
    then
    echo “Usage: ${0##*/} your tweet as you would like it to read”
    exit 1
    fi
    tweet=$1
    curl -u $USERNAME:$PASSWORD -d status=”$1″ http://twitter.com/statuses/update.xml

  6. Update Your Twitter Status from Terminal : little brain Says:

    […] Yes, you could update using your favourite instant messaging client, or texting from your cellphone. But that aren’t the way to looked geeky. Updating from terminal is geekier. […]

  7. Post to Twitter via the terminal Says:

    […] has a really geeky tip on updating your Twitter status via the terminal. What you need is cURL. You could search your package manager for it (be it YAST, Apt, or something […]

  8. Send Twitters from the Command Line in Any OS [How To] Says:

    […] reminders. Got an easy way to set this up in your own OS? Share your experience in the comments. Posting to Twitter from the Terminal Window [Digital Streets / […]

  9. Send Twitters from the Command Line in Any OS [How To] | net is everything Says:

    […] reminders. Got an easy way to set this up in your own OS? Share your experience in the comments. Posting to Twitter from the Terminal Window [Digital Streets / […]

  10. Ali Sattari Says:

    mix some zenity with it and you made a one-line-command twitter client :)

  11. randulo Says:

    Thanks for posting this, no one has time to imagine every possible solution and this is a good one.
    I would have guessed that to the real geek it’s obvious why this is of interest: use a cron job to automate posts to announce recurring events via twitter.

    /r

  12. Combining Two or More Geeky Things - Popular Blur Says:

    […] This is was from a blog post that went up on my birthday, and it caught my eye because, well, it’s geeky-cool. It takes Twitter, a somewhat geeky online micro-blogging platform, and combines it with the command line (need I say more). This apparently works for Windows, Mac, and Linux. I got it working on my Xubuntu in literally less than a minute. Here’s the link: Digital Streets […]

  13. Magnus Says:

    I adopted it with a dialog box from Zenity…

    #!/bin/bash
    #
    USERNAME=”your_username”;
    PASSWORD=”your_pass”;
    tpost=$(zenity –entry –title=”Twitter” –text=”What are you doing?”)

    echo ${#tpost};

    if [ ${#tpost} -gt 0 ]
    then
    echo $tpost
    curl -u $USERNAME:$PASSWORD -d status=”$tpost” http://twitter.com/statuses/update.xml
    else
    echo “BLANK!”;
    fi

  14. Jason Says:

    wget also works (and may already be installed if curl isn’t):

    wget -O - –user=YOURUSERNAME –password=YOURPASSWORD –post-data=”status=YOUR NEW STATUS HERE” http://twitter.com/statuses/update.xml

  15. Twitter Updates from Terminal Says:

    […] Via Digital Streets ] No Comments, Comment or […]

  16. Michael Klier Says:

    Hi,

    that’s a nice tip, however I’d consider to use https:// instead of http://, it works too and is way saver to send your username/password around.

  17. Michael Klier Says:

    “mix some zenity with it and you made a one-line-command twitter client”

    That actually exists already ;-): http://www.chimeric.de/projects/zentwitter

  18. Command line Twitter | PC Sympathy Says:

    […] to Twitter from the Terminal Window - Link cURL downloads - […]

  19. Command line Twitter | Development Feeds Says:

    […] to Twitter from the Terminal Window - Link cURL downloads - […]

  20. Command line Twitter | Development Feeds Says:

    […] to Twitter from the Terminal Window - Link cURL downloads - […]

  21. My Linux Web » Send Twitters from the Command Line in Any OS Says:

    […] reminders. Got an easy way to set this up in your own OS? Share your experience in the comments. Posting to Twitter from the Terminal Window [Digital Streets / Tech-Recipes.com] Bookmark this article! […]

  22. Ubuntu: Posting to Twitter from the Terminal Window « Twitter Apps Says:

    […] « JustUpdate Ubuntu: Posting to Twitter from the Terminal Window April 11, 2008 Ubuntu: Posting to Twitter from the Terminal Window - mini tutorial from Digital Streets. Install cURL (a command line tool) and then Tweet from the […]

  23. Psychopsia Says:

    @chukaman: I changed this: status=”$1″
    to: status=”${tweet}”

    (tweet is defined in previous line)

  24. ruvido Says:

    This is very geeek and effective. Thanks for the tip!

    anyway I think you should put:

    status=”$*”

    in this way from terminal you will not use “”. For example:

    [yourmachine]$ twiterit hi I\’m here

    it will post directly “hi I’m here”

    Enjoy

Leave a Reply