How To Access Twitter Via Command Line (Terminal)

Hello Guys,

Everyone has at least one social media account. Twitter is a great one that most people like as well. I like tweeting too. Yes we use the Terminal for a lot of stuffs, we can also use this terminal with Twitter. Is very easy and geeky. Imagine you tweeting from the Terminal among your friends. What will they say? A lot. The command line is always power. The tool that will make tweeting from Terminal a success is known as t. With this we can do almost everything that is possible in the browser with Twitter, be it sending DMs, checking profiles, follower, follow and unfollow someone, etc.

I have personally tested this on Ubuntu and Crunchbang. It works perfectly.

Install Twitter CLI on Linux

To install Twitter CLI on Debian based distros:

$ sudo apt-get install ruby-dev
$ sudo gem install t

To install Twitter CLI on CentOS, Fedora or RHEL:

$ sudo yum install ruby-devel
$ sudo gem install t

After installation, enter the command below and press enter:

$ t authorize

twitter5

This opens the Twitter developer sign page. Sign in with your Twitter account.

twitter1

First we need to create a Twitter application (so easy). Locate Create an application, or you can visit here. Enter app Name without the word Twitter. Description and website and save.

twitter2

Navigate to the Settings tab as in the figure below.twitter3

You can choose an image for your app if you wish. Also change application type to  Read, Write and Access direct messages. Now save application.
twitter4Now go back to app Details tab. 
twitter6

Enter Customer Key and Customer Secret,

twitter_keysPress Enter again. You will be prompted to enter PIN, and browser automatically opens. Login and Authorize App.
twitter7

After clicking Authorize App, you will then be presented with PIN.twitter8

Enter PIN and Press Enter. Authorization should be successful as shown below.
twitter_complete

 Now you can do everything from checking someones profile, sent tweets, send DM’s, etc. Below is commad for checking a profile:

$ t whois @unixmen

whois

Below are some commands, also see $ t help for more

 t accounts                        # List accounts
 t authorize                       # Allows an application to request user authorization
 t block USER [USER...]            # Block users.
 t delete SUBCOMMAND ...ARGS       # Delete Tweets, Direct Messages, etc.
 t direct_messages                 # Returns the 20 most recent Direct Messages sent to you.
 t direct_messages_sent            # Returns the 20 most recent Direct Messages you've sent.
 t dm USER MESSAGE                 # Sends that person a Direct Message.
 t does_contain [USER/]LIST USER   # Find out whether a list contains a user.
 t does_follow USER [USER]         # Find out whether one user follows another.
 t favorite TWEET_ID [TWEET_ID...] # Marks Tweets as favorites.
 t favorites [USER]      # Returns the 20 most recent Tweets you favorited.
 t follow USER [USER...] # Allows you to start following users.
 t followers [USER]      # Returns a list of the people who follow you on Twitter.
 t followings [USER]     # Returns a list of the people you follow on Twitter.
 t friends [USER]        # Returns the list of people who you follow and follow you back.
 t groupies [USER]       # Returns the list of people who follow you but you don't follow back.
 t help [COMMAND]        # Describe available commands or one specific command
 t leaders [USER]        # Returns the list of people who you follow but don't follow you back.
 t list SUBCOMMAND ...ARGS    # Do various things with lists.
 t lists [USER]               # Returns the lists created by a user.
 t mentions                   # Returns the 20 most recent Tweets mentioning you.
 t open USER                  # Opens that user's profile in a web browser.
 t reply TWEET_ID MESSAGE     # Post your Tweet as a reply directed at another person.
 t report_spam USER [USER...] # Report users for spam.
 t retweet TWEET_ID [TWEET_ID...] # Sends Tweets to your followers.
 t retweets [USER]           # Returns the 20 most recent Retweets by a user.
 t ruler                     # Prints a 140-character ruler
 t search SUBCOMMAND ...ARGS # Search through Tweets.
 t set SUBCOMMAND ...ARGS   # Change various account settings.
 t status TWEET_ID          # Retrieves detailed information about a Tweet.
 t stream SUBCOMMAND ...ARGS # Commands for streaming Tweets.
 t timeline [USER]          # Returns the 20 most recent Tweets posted by a user.
 t trend_locations    # Returns the locations for which Twitter has trending topic information.
 t trends [WOEID]           # Returns the top 10 trending topics.
 t unfollow USER [USER...]  # Allows you to stop following users.
 t update [MESSAGE]         # Post a Tweet.
 t users USER [USER...]     # Returns a list of users you specify.
 t version                  # Show version.
 t whois USER               # Retrieves profile information for the user.

Enjoy.