Twitter from the Command Line

This simple but not perfect script will let you twit easily from the command line.

Open a new file with your favorite text editor, and add this:

1
2
3
#!/bin/bash
curl --basic --user USERNAME:PASSWORD \
--data status="$*" http://twitter.com/statuses/update.xml -o /dev/null;

Save the file as twit (or any other name you choose).

Of course, we don’t like our password inside an accessible plain text file. So this is what I did:

sudo mv twit /usr/local/bin/.

sudo chmod 551 /usr/local/bin/twit

sudo +s /usr/local/bin/twit

sudo chown root /usr/local/bin/twit

Now, only root can read the file, but a regular user can execute it. Maybe my solution is not the best possible, but it works.

Anyway, now, you can use this to twitter from the command line:

twit “This was posted from the command line”

That’s it. Enjoy ;)


This post was based on a post from LinuxJournal.com


[Post to Twitter]  [Post to Yahoo Buzz]  [Post to Delicious]  [Post to Digg]  [Post to Ping.fm]  [Post to Reddit]  [Post to StumbleUpon] 

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts:

  1. Send Email from the Command Line using Gmail Account
  2. Command Line Tools I Like
  3. Query Google Finance From the Command Line
  4. Send Self Reminders To Your Email From The Command Line
  5. Modify Ctrl-Alt-Del Behavior in Linux

Tags: ,

Saturday, November 22nd, 2008 Command Line

1 Comment to Twitter from the Command Line

  • Brett Dreher says:

    Fun tip, finally gave me an excuse to sign up for twitter and give it a shot, thanks :)

  • Leave a Reply

    my email
    Check my other blog at:
    http://amirwatad.blogspot.com
    my photo
    Hi,
    My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and am currently studying for a BSc. in electrical engineering at The Electrical Engineering school , Technion , Israel.
    I work at the verification dept. in Mellanox Technologies Ltd.
    I love Linux, the Command Line and the OpenSource Community.
    I used to write Poems (Arabic) when I was able to find time for this.
    November 2008
    S M T W T F S
    « Oct   Dec »
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30  
    Opensource Logo
    SEO Powered by Platinum SEO from Techblissonline