tweet from linux command line

Introduction

Rainbow Stream allows you to manage just about every aspect of your Twitter account from the command line. Yes, you did read that right. It's a full featured command line Twitter client written in Python. Chances are, you're falling into one of two camps right about now. If you're in the slightly insane one that thinks this is a good idea, stay tuned. Rainbow Stream actually does provide an simple and intuitive Twitter experience from the Linux command line.

Prerequisite Packages

You probably have everything that you need to get Rainbow Stream working on your system right now, but just to be sure, there are a few packages that you should install if you haven't already. Debian Distros
# apt-get install python-dev libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev virtualenv
Redhat Distros
# dnf/yum install python libjpeg freetype freetype1 zlib python-virtualenv

Set Up The Virtualenv

So, you don't exactly need Virtualenv, but Rainbow Stream pulls in a lot of dependencies, and since you're going to need to manage it with Pip, you probably need want to compartmentalize it into its own virtual environment.

Figure out where you want your Twitter environment, and create your virtual environment.
$ virtualenv -p python3 twitter
Now, cd in to your new twitter folder, and activate the environment.
$ cd twitter
$ source bin/activate
That's it. You're ready to install.

Install Rainbow Stream

Pip is the best way to manage Rainbow Stream, since it's a Python package that isn't packaged by many, if any, major distributions at the time of this guide. That's alright, though. Installing it with Pip is very easy.
pip install rainbowstream
Pip will run through a relatively lengthy installation process to pull in Rainbow Stream and all of its dependencies.

Basic Usage

First Run

You will always need to be in your virtual environment with it activated to run Rainbow Stream. Once you're there, you can start it up like any other CLI application.
$ rainbowstream
On your first run, Rainbow Stream is going to ask you to grant it permission to access your Twitter account. It will automatically open up a web browser on your computer to the Twitter page needed to grant external applications permission to access your account. Fill out your Twitter username and password, and confirm Rainbow Stream's access.

After your successful confirmation, the terminal window will display your Twitter handle in ASCII art and log you in.

Setting Your Stream

By default, Rainbow Stream will populate with new tweets from your stream as they arrive. You don't need to do anything extra in order to see incoming tweets, and you don't need to refresh.

Rainbow Stream does eventually timeout if you haven't been active for a while. When this happens, you have to reactivate your stream. You can do this by typing in the following.
stream mine

Getting Recent Tweets

If you've just signed on, and you want to see past tweets from when you were away, you can use Rainbow Stream's home command to collect a specific number of past tweets.
home 10

Opening a Tweet

Rainbow Stream assigns every tweet that comes in an ID. These IDs are unique to the session, but do reset. It doesn't really matter, though. They're just for interacting with tweets as they come in or right after they were pulled. To open up a tweet or the link from it, use the built in command.
open id#
Just include the number in place of #id.

Tweeting

Tweeting from Rainbow Stream is very simple. Just add the letter t before the text you want to tweet out.
t Rainbow Stream is awesome! #cliftw

Retweeting

Retweeting from Rainbow Stream uses its ID system. Type rt followed by the ID number of the post that you would like to retweet.
rt 15

Following

You can probably see a pattern developing here. Like most other CLI programs, everything is done with simple commands that have parameters. The same is true for following someone.
fl @linuxconfig

Favorite

To favorite a tweet, use fav and the tweet ID.
fav 15

Quoting

Quoting is just like the other ID based commands.
quote 15
If you want to see what is trending globally, just type trend. If you want the trends for your country, add the two letter country code.
trend US

Themes

Rainbow Stream has multiple available themes that change the color scheme of posts in your stream. To list out the themes, type theme. To set the theme, add the name of the theme.
theme tomorrow_night

Config

Rainbow Stream has a fairly simple configuration system. To see the available options, type config. You will see a list of the available options and their current values. To change one, type config again followed by the item that you'd like to change set equal to the new value.
config IMAGE_ON_THERM = True
The above command will cause the images associated with the tweets in your feed to appear in the terminal... extremely pixelated.

Getting More Help

There's a lot more that Rainbow Stream can do. Unfortunately, it'd take way too long to go over it all in a single guide. However, the Rainbow Stream developers have built an awesome help system into their Twitter client. To see a help overview, type h. This will give you a general picture of the help categories that are available. To get more specific help, type h followed by the category that you're looking for.
h tweets
You can use this method as a quick reference whenever you need.

If you're looking for even more depth, you can always check out the http://www.rainbowstream.org/ Rainbow Stream website.

Closing Thoughts

If you're the type of person that absolutely loves the command line, and wants a Twitter client to fit your minimalist computing style, Rainbow Stream is just the thing for you. It's actually very simple and intuitive once you get used to its system, and even if you forget, the help system is great. Rainbow Stream also makes an excellent compliment to tiling window managers, so if you're a fan of those, you should definitely give it a shot as well.