dcsimg

Tweeting from the Command Line with Twyt

When 140 characters is all you need, the command line does it better.

As you’ve probably realized by now, I love the command line. Part of the reason for my obsession with the command line is that I work at the command line for most of every day at my day job. With the exception of the few Windows hosts to which I must connect for certain operations, I never see a graphical interface. And, in keeping with my need to stay command line connected, I sought out a command line Twitter client to help me stay current with my all-important Twitter statuses. I chose the somewhat obscure, Python-based Twyt project to use as my Twitter companion.

I don’t care much for social networking but I submit that it is the way of the world and so, I reluctantly conform to what’s current. I wouldn’t want to deprive my followers (Twits?) of knowing what I had for breakfast nor would I want to deprive myself of the vital goings on of those whom I follow. Since I have little time (or tolerance) for chasing the web-based Twitter client, I decided to use the command line client for all my Twitter-based interactions—and of course to keep up with the multitude of tempting multilevel marketing opportunities tossed my way on an hourly basis.

Installation

I can often be a Linux purist and prefer to install from source. Fortunately, the developer provides the source tarball for those of us Ludites who either use a distribution that doesn’t incorporate Twyt or who are control freaks and must know what’s going on and have the option to alter it. It’s also for those of us who love to chase endless dependencies and then complain about them later.

For those of you who, instead, use packaging systems, you need python, python-simplejson and python-twyt. The rest of us will have to install the dependencies first, then download the tarball from the Twyt Download Repository and run the installation script at a command line.

# setup.py install

Once you’ve installed the dependencies and the Twyt package itself, you’re ready to update your throng of panting followers of your latest conquests and adventures.

Tweeting with Twyt

Broadcasting your breaking news bits is a simple task. It’s no more difficult than tweeting on the Twitter site or using some other third-party tweet application and help is at your fingertips. Let’s start by looking at that list of commands and finding help.

$ twyt --commands

usage: twyt  COMMAND [options] [args]

Available commands:
 accountlimit Show the API rate limit for your Twitter account.
        block Blocks a user specified by ID (numerical ID or screen name)
       delete Deletes a tweet by ID
       direct Sends a direct message to another user
    directdel Delete a direct message which was sent to you
   directsent Prints the 20 last direct messages sent by you
     directtl Prints the 20 last direct messages sent to you
    friendstl Returns 20 most recent statuses in your friends timeline
      iplimit Show the API rate limit for your IP address.
    namecache Access and manipulate the username cache.
     publictl Shows the 20 most recent statuses in Twitter's public timeline
      replies Lists statuses which are replies to you (statuses with @yourusername in them)
         show Show a single status message by ID
         sing Similar to 'tweet', wraps the status in musical notes
        tweet Updates the authenticating user's Twitter status
      unblock Unblocks a user specified by ID (numerical ID or screen name)
         user Get and set Twyt user options, e.g. remembered passwords and Twitter usernames
       usertl Show your timeline, or USERNAME's timeline

For command-specific help, use twyt COMMAND --help

Use the tweet command to send a new message. You must surround your message in double quotes.

$ twyt tweet "Hello, everyone, catch this article Monday on Linux Magazine at linux-mag.com" –u kenhess

Enter kenhess's Twitter password:

[8782187385] kenhess: Hello, everyone, catch this article Monday on Linux Magazine at linux-mag.com (Sun Feb 07 22:43:14 2010 via Twyt)

To prevent the constant prompting for your password when you enter a command, you can enter it on the command line with your tweet or other commands with your username:

$ twyt tweet "Hello, everyone, catch this article Monday on Linux Magazine at linux-mag.com" –u kenhess –p SuperSecretPassword

[8782187385] kenhess: Hello, everyone, catch this article Monday on Linux Magazine at linux-mag.com (Sun Feb 07 22:43:14 2010 via Twyt)

To set your username and password permanently, use the following command:

$ twyt user –user=kenhess set

Enter kenhess's Twitter password:

This action saves your username and password to a hidden file in your home directory named .twytrc.json. You can now use twyt without specifying your username or password.

Microblogging Culture

Unless you’ve hidden yourself away in a non-Internet connected Monastery for the past few years, Twitter is computing’s newest rage of the age. Whatever you can say in 140 characters or less, capture’s the ever-shortening attention spans of your followers. Followers are people who care enough about you to read your tweets (your short messages posted to twitter.com). You, in turn, follow people you care about but can only tolerate in short blasts.

This 140 character microblogging is for those of us too busy for Facebook, phone calls or text messages. We want the latest news and information without all the annoying details. When you want to know who’s recently clipped their toenails, who’s attending a Tea Party or who’s breaking up with their girlfriend; Twitter is the place to catch it all.

The basic rule of Twitter: If you can’t say it in 140 characters or less, no one cares, because you can’t say it on Twitter.

Tweeting, for some, is a way of life. I use it to promote stories, like this one, and to keep track of important announcements and news bits from a select few (1,600 or so at last count) of my closest friends and colleagues. Twyt is only one of a few different command line Twitter clients but it is one of the best I’ve seen and the only one I use with regularity. I appreciate its ease of use, small footprint and few dependencies. Twyt is such a pleasure to use, it almost makes me enjoy using Twitter. In just the time it took me to write this article, I’ve missed almost 400 updates and I must catch up—at the command line, of course. Happy tweeting.

Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62