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
No related posts.
1 Comment to Twitter from the Command Line
Leave a Reply
About Me
Tags
Categories
- Algorithms
- Bash
- BlackBerry
- Collaboration
- Command Line
- Cool Tricks
- Easter Eggs
- Ebooks
- Firefox
- Hardware
- Humor
- iPhone
- Linux
- Linux Development
- Linux Kernel
- Networks
- Open Knowledge
- Other
- Productivity
- Programming
- Regular Expressions
- Science
- Security
- Shell Scripts
- Short Posts
- Social Networks
- Thoughts
- Tools
- Vim
- Web Development
- Websites
Popular Posts
Calendar
Archives
- September 2010 (2)
- August 2010 (2)
- July 2010 (5)
- June 2010 (1)
- May 2010 (1)
- April 2010 (3)
- March 2010 (1)
- January 2010 (1)
- December 2009 (2)
- September 2009 (13)
- July 2009 (1)
- June 2009 (6)
- May 2009 (4)
- March 2009 (18)
- February 2009 (10)
- January 2009 (10)
- December 2008 (7)
- November 2008 (8)
- October 2008 (1)
- August 2008 (1)
- July 2008 (1)
- June 2008 (1)

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