Today I decided that I’m going to give twitter another try, but the first thing that struck me was how cumbersome it was to actually post a tweet.

The way I did it:

  1. Open your favourite browser
  2. Go to twitter.com
  3. Log in
  4. Write a tweet

I’m a Linux user and I love the terminal. Wouldn’t it be better to write tweets from the terminal? – Yes it would!

I have written a quick and dirty python script that enables you to write tweets from the terminal.

You can download the script here.

Install guide for Debian:

Step 1: Download

$ wget http://dibon.net/tweet
$ chmod +x tweet
$ sudo mv tweet /usr/bin/

Step 2: Install curl

The script uses curl to send data to twitter, if you don’t have curl installed you have to install it:

$ sudo aptitude install curl

Step 3: Make the config

Make a file called “.tweet” in your home directory:

$ vim .tweet

And insert the following:

[login]
username = YOURUSERNAME
password = YOURPASSWORD

You may want to edit the permissions for the file

$ chmod 0700 .tweet

That’s about it. You may have you reopen your terminal window before you can use the tweet command.

Usage:

$ tweet "I'm writing a tweet in terminal!"

Unfortunately it is necessary to use single or double quotes before and after the message.