A command-line Twitter client
Command Line – Rainbow Stream
If you prefer to work from the command line, Rainbow Stream offers a quick and flexible Twitter client.
Twitter and similar microblogging services are usually accessed from the desktop or a web browser. A rare exception is Rainbow Stream [1], which runs from the command line. Like most command-line interface (CLI) applications, it requires some learning, but once you are familiar with it, Rainbow Stream proves surprisingly quick and flexible, as well as a useful way to keep your hands on the keyboard to reduce repetitive stress injuries. With tweeting, navigation, filtering, and other functions accessible through a brief command, Rainbow Stream is a mostly complete Twitter client that is in some ways more efficient than many desktop alternatives. Overall, it is reminiscent of Alpine, the email client that was common on mainframes a couple of decades ago.
You will not find Rainbow Stream in the repositories of most distributions. The reason seems to be because it installs using pipenv
, Python's dependency manager. You may already have most of the required packages installed, but to confirm enter the command:
sudo apt-get install python-dev libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev python-pip pythonX
Currently, you need Python 2.7 or higher (although in the next release, the oldest supported version will be 3.6). To install, enter
pip install rainbowstream
or
pip3 install rainbowstream
depending on the Python version you are using (Figure 1).
Alternatively, you can install Rainbow Stream using virtualenv
, as described in the documentation [2].
To use Rainbow Stream, run a Twitter account and enter the command rainbowstream
. If you have not already authorized Rainbow Stream to use that Twitter account, Rainbow Stream will open your web browser for you to obtain an authorization number to enter at the command line (Figure 2). Strangely, in Fedora, you are given a chance to choose the Twitter account to use, while in Debian Rainbow stream chooses one of your existing accounts apparently at random.
After authorization, Rainbow Stream notifies you about any development news, the version you are using, and any errors in setup (Figure 3). Your stream is immediately available. The default theme is brightly color-coded, with the tweeter's name in orange, their Twitter handle in green, how long ago they posted in blue, and so on. Pay special attention to the ID, which you will need to interact with the tweet (Figure 4).
Basic Navigation
Rainbow Stream can quickly fill the screen. At times, you may want to press the p key to pause the stream if you want to focus on Rainbow Stream's help or the currently displayed tweets. When you are ready, pressing r will unpause the screen. You can also press c to clear the current display completely. Before you settle down to read, you may want to type h to look at the help (Figure 5). No prompt is available – just type the command in the terminal. To exit, press the q key.
Navigation and filtering are where Rainbow Stream excels. In Twitter's default web interface, navigating may involve scrolling, followed by selecting from the navigation pane on the left of the screen, and possibly more scrolling. By contrast, in Rainbow Stream, you can scroll using the arrow keys, but this is not the most efficient method of getting around. It is far easier to use Tab autocompletion. Better yet, you can navigate by typing brief commands and then pressing the Enter key. All commands can be entered alone, but you can append some commands with a string of letters to narrow the topic, a specific Twitter tag to view, or a number to indicate the number of tweets to display. After being on Twitter for more than a few moments, you might want to use me NUMBER
to reduce the amount of scrolling you have to do.
Rainbow Stream supports all of Twitter's basic features. With the command trend
, you can view the popular tweets on Twitter, filtering the response with a single word. Alternatively, s STRING
searches Twitter for people and topics. When you have located an account, whois @ACCOUNT
shows the account's profile and view @TAG NUMBER
the account's timeline. For those who are curious about their own Twitter presence, mentions NUMBER
show tweets from others that mention you, while notification
shows your notifications since you started Rainbow Stream. You also can refer back to your own tweets (last one first) with me NUMBER
. And if you get lost, home NUMBER
will return you to your timeline.
Basic Tweeting
To tweet, press t, followed by the text of the tweet. No quotation marks are required. Rainbow Stream will not post a duplicate tweet, nor will it tweet more than 144 characters – which is the old (not current) limit. Should you post a longer tweet, Rainbow Stream will post only 144 characters and drop the rest with no warning. The same limitations apply to any retweet or any other form of retweeting.
However, to retweet, you have to add the ID of the original tweet. For example, rt 11
retweets the tweet in the current tweet with that ID. For your convenience, the ID is reprinted alongside your retweet. You can use quote COMMENT ID
to retweet a message with your own mandatory comment, or you can see a list of all retweets with rt ID
, followed by an optional number of retweets to display, or conversation ID
to show the complete conversation in which the retweeted message appears.
Other basic commands include fav ID
to make a tweet a favorite, or ufav ID
to unfavorite a tweet. Similarly, with share ID
, you can copy a link, and image ID
uploads an image in your default image viewer. In addition, with open ID
, you can open a tweet in your default browser – which can be a convenient alternative to searching or scrolling to find the tweet.
You can scan Direct Messages (DMs) with the inbox
command, using thread ID
to show a complete thread and trash ID
to remove a message. The command list
will show which DM lists you belong to, and list home
will ask you for the name of a list whose timeline you wish to display. You can use list sub
and list unsub
to manage your subscriptions and list add
and list rm
to edit the people on lists that you run.
Curious about your followers? You can view a complete list with ls fl
. Similarly, ls fr
displays the people you are following. You can add a follower with fl @ACCOUNT
or unfollow with ufl @ACCOUNT
. Should someone become obnoxious, you can mute them (mute @ACCOUNT
) or block them (block @ACCOUNT
). Conversely, you can unmute (unmute @ACCOUNT
) or unblock (unblock @ACCOUNT
) them if you change your mind. Spam accounts can be reported with report @ACCOUNT
.
None of these operations is unique. You can get the same functionality in Twitter's default web browser. However, these operations are faster in Rainbow Stream, requiring no copying and pasting or deleting with the mouse. The commands can take time to learn, but almost all are consistent in their structure, which makes them easier to learn than their sheer number might suggest.
Configuration and the Interactive Shell
Rainbow Stream installs with five multicolored themes. The command theme
lists the theme, showing monokai as the current theme (Figure 6). To change the theme, enter theme THEME
. For more detailed configuration, you can edit ~/.rainbow_config.json
(Figure 7). Most of the approximately 30 options in .rainbow_config
can be set to true or false. Most options do things like set the number of tweets to display in a given circumstance, the order in which information for each tweet is displayed, or how long the app can be inactive before it hangs up. Other options set things such as the format for date and time. The .rainbow_config
file overrides the app's default.conf
file. Should the format become invalid because of edits, Rainbow Stream will still start, and you can overwrite rainbow_config
to try adding customization again.
Since Rainbow Stream is a Python interactive shell, it can also run most other scripts designed for an interactive shell. For example, you can use it as a calculator by using +, -, *, and / for basic operands. You can also use cal
to display a calendar for the current month (Figure 8). This functionality can sometimes save you the trouble of switching from the terminal where you are running Rainbow Stream to the desktop.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.