Using Twitter from the command line

Twitter is the tool used by almost everyone these days to send and receive instant updates. Each update on Twitter is just some text with up to 240 characters, which makes it easy to compose and quickly share information with friends.

The nature of these updates ranges from personal to technical. Many people use twitter just to keep in touch with friends. Others, have employed twitter to do mechanical tasks, such as keeping logs, of even communicating with machines.

Twitter is a useful service that lets people to communicate with as many people as they want. The technology allows also anyone to subscribe to any person, so you can receive updates instantaneously.

In this article, I describe how to interact with twitter from a command line interface.

Alternate Interfaces

One of the reasons some people dont like facebook and twitter is that they require users to have a browser open all the time to update status. This is not true, however, in the case of twitter. Numerous programs have been created to allow easy update of twitter status.

For example, twirl is one such program that can be used to send and receive twitter updates without openning a web browser. Twirl is a desktop program (written using Adobe Air) and is really easy to install and use.

Command-line Interface

However, power users frequently dont like to be bound to a graphical user interface. If you have experience, it is in many cases easier just to type a few commands in the terminal and get the job done.

I am one of these people, by the way.

One way of avoiding the necessity of a GUI for twitter updates is using the command line interface such as in http://gabrielcain.com/projects/twitter/.

The steps are as follow:

  • download the script written in perl twitter.pl from the address above

  • install it on a directory in the $PATH.

  • add the accompaning library Twiter.pm to the perl libraries. You can also add a line such as use /path/toTwiter.pm

The final step is to run twitter.pl, and answer the questions to create a configuration file, which is save at ~/.twitterrc.

Now you are ready to use twitter to contact everyone, by just typing

> twitter.pl 'your update here'

References

Tags: line, command, client, twitter
Article created on 2009-04-21 23:25:54
coliv2 Said:
Agreed, there are a lot of tools that can talk to Twitter. The twitter script, however, is very simple and does the job well.
Comment added at 2010-01-02 21:23:20
wally Said:
No need to use perl, you can use this simple bash script (call it twit_this or wathever you like): #!/bin/sh # usage: twit_this "message to send" user="theUser" pass="thePassword" curl -s --basic --user "$user:$pass" --data-ascii "status=`echo $@ | tr
Comment added at 2009-06-04 05:03:01

Post a comment