Twidge microblog client

Lead Image © pixxart,

Tweeting from the Terminal

The Twidge microblogging tool is easy to learn and provides a much less cluttered environment than Twitter.

You won't find Twidge [1] on a list of the top 25 microblog clients. Such lists rarely mention command-line tools – which is too bad, because Twidge is not just more powerful than desktop tools but also easier to use in many ways.

In the classic free software tradition, Twidge was written "to scratch an itch." Long-time Debian developer and Twidge's creator John Goerzen explains, "I was using Twitter, but frustrated at having to go online to see what was waiting for me." For Goerzen, other shortcomings of the Twitter web interface included "not being able to clear most tweets as read and save some for replying to later, and not being able to use it offline." Additionally, Goerzen wanted Twitter to have the potential to interact with email – specifically, Postfix and Exim – and shell scripts, which explains the combination of "Twitter" and "bridge" in the name.

Now at version 1.10, Twidge has accomplished all these goals and gained a small following among Debian and Ubuntu users, as well as other distributions, including Arch Linux. The reason for this modest popularity is not hard to understand: Twidge is easy to learn and provides a much more uncluttered environment for reading tweets than Twitter's own web interface.

Setting up Twidge

If you are starting from the Raspbian graphical user interface (LXDE), first open the terminal on your Raspberry Pi by double-clicking the LXTerminal icon on the desktop, then enter the commands

sudo apt-get update
sudo apt-get install twidge

to update your sources and install Twidge.

At this point, make sure you are in the LXDE desktop (enter startx from the boot screen), because you'll need a browser. Before you can use Twidge, you must configure it with the command:

twidge setup

which opens a text wizard to take you through the authorization process (see Figure 1).

Figure 1: Setting up Twidge requires a brief venture onto the web to connect with Twitter.

After you copy and paste the link to Goerzen's website from the installer to your browser, you are taken to a page on which you sign in to your account and authorize Twitter to accept Twidge. Pressing the Authorize App button (Figure 2) produces a PIN that you type into the Terminal window beside the Authorization key line.

Figure 2: Authorizing Twidge.

The installer creates the .twidgerc file in your home directory. Because the file stores the authorization number in plain text, for the sake of security, you should limit its permissions so that only you can view it.

Reading and Writing Tweets

Like many commands that originated for Debian, Twidge uses both subcommands and options. A typical command structure looks like this:


A good place to start is with the command twidge lscommands, which lists the available subcommands. Twidge assumes that you know the names on the accounts that you want to read, but if you don't, you will have to refer to the web interface because Twidge lacks a search mechanism.

You might also want to get into the habit of using -s or --saveID. This option notes the ID of the last message displayed, so if you use -u or --unseen the next time you check messages, only the unread ones are displayed. To read the tweets sent since you last ran Twidge, you can combine the subcommand lsrecent, which lists posts made by you or those you follow, with lsreplies, which lists replies to your tweet. The first time you log in after any absence, the number of tweets is likely to be long, so you can pipe the two commands through less so you can scroll back and forth easily:

(twidge lsrecent -su; twidge lsreplies -su) | less

Other commands for reading that you might use are lsdm, which lists any direct messages to you, and lsrtreplies, which lists retweets of your messages. Some of these commands, such as lsrtreplies and lsdm, are not supported in and will give you an error message if you use them.

If you prefer, you can add the -a or --all option to view all available tweets (Figure  3), rather than the top 20 or 100 specified by the microblogging site. To arrange information neatly in columns, you can add -l or --long (Figure 4). If you followed the instructions to set up email, -m **EMAIL or --mailto=EMAIL will route messages to the email client. To write a tweet, use the subcommand update, followed by your tweet in quotation marks:

twidge update "TWEET"
Figure 3: Twidge displays retrieved tweets in an easy-to-read format.
Figure 4: The long display gives more information about tweets.

No status confirmation indicates that the tweet has been sent successfully. However, when a tweet exceeds Twitter's or's 140-character limit, Twidge's default behavior is to shorten any recognizable URL in the tweet. If a tweet is too long, Twidge fails to complete and does not send it. Twidge also includes the ability to send private tweets, which it calls direct messages. You can send a direct message with the command:

twidge dmsent ACCOUNT

Additionally, Twidge includes what might be called housekeeping subcommands. You can look back at tweets you have sent with the lsarchive subcommand or your retweets with lsrtarchives and your direct messages with lsdmarchives.

Using block or unblock followed by an account name will control whether a particular user can reply to your tweets, although they will still be able to read them. Similarly, you can use follow and unfollow to set whether you receive tweets from a particular account. None of these subcommands returns a status message after running; however, blocking an already blocked account or following an already followed account will leave the command uncompleted.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content