Ubuntu: Posting to Twitter from the Terminal Window
March 4th, 2008
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:
- Open a terminal window.
- Execute the following Terminal command:
sudo apt-get install curl - 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.

March 4th, 2008 at 9:09 pm
ohhh!.. thats just uber geeky.
March 5th, 2008 at 6:35 am
Sweet! Totally will bump this up to the front in the next 24 hrs. Very nice.
March 7th, 2008 at 9:27 am
What the heck is “Twitter”?
March 7th, 2008 at 2:34 pm
@Alan: http://www.youtube.com/watch?v=ddO9idmax0o
Welcome to teh intarwebnets!
March 7th, 2008 at 3:05 pm
#!/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
March 7th, 2008 at 7:35 pm
[…] 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. […]
March 7th, 2008 at 8:09 pm
[…] 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 […]
March 7th, 2008 at 11:03 pm
[…] 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 / […]
March 8th, 2008 at 3:51 am
[…] 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 / […]
March 8th, 2008 at 4:10 am
mix some zenity with it and you made a one-line-command twitter client
March 8th, 2008 at 5:44 am
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
March 8th, 2008 at 12:54 pm
[…] 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 […]
March 8th, 2008 at 6:44 pm
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
March 9th, 2008 at 11:07 pm
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
March 10th, 2008 at 1:39 am
[…] Via Digital Streets ] No Comments, Comment or […]
March 10th, 2008 at 2:59 am
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.
March 10th, 2008 at 3:04 am
“mix some zenity with it and you made a one-line-command twitter client”
That actually exists already ;-): http://www.chimeric.de/projects/zentwitter
March 10th, 2008 at 4:56 am
[…] to Twitter from the Terminal Window - Link cURL downloads - […]
March 17th, 2008 at 11:47 pm
[…] to Twitter from the Terminal Window - Link cURL downloads - […]
March 17th, 2008 at 11:47 pm
[…] to Twitter from the Terminal Window - Link cURL downloads - […]
April 6th, 2008 at 7:00 pm
[…] 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! […]
April 11th, 2008 at 1:47 am
[…] « 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 […]
May 13th, 2008 at 1:25 pm
@chukaman: I changed this: status=”$1″
to: status=”${tweet}”
(tweet is defined in previous line)