Social Media from the Command Line, Part 1: Facebook and Twitter

Be the envy of all your geekiest friends by using command-line programs to access your favorite sites and online tools. After reading this article series, you’ll be able to update your status on Facebook and Twitter, post to your Blogger and Tumblr accounts, watch YouTube videos, and manage your Flickr albums all from the comfort of your terminal. Today in Part 1, we’ll cover Facebook and Twitter. Let’s go!

1. Facebook

You can access most of Facebook’s main features from your Linux, Mac, or Windows command line with fbcmd.



You need to have PHP installed on your system before you can install FBCMD. Once you’ve gotten that out of the way, go ahead and grab the file “fbcmd_update.php”; you can manually download it here or run the following command:


Next run these two commands:

php fbcmd_update.php
php fbcmd_update.php install

FBCMD is now installed, but you still need to perform a series of steps to authorize it to access your Facebook account. In your default web browser, log in as the user you want to perform the authorization for. This command will then take you to the basic authorization page:

fbcmd go access


Click “Go to App”; you should be taken to a page that says “Success.” FBCMD still needs authorization to access your account offline. Run:

fbcmd go auth

When this page opens up in your default browser, click “Generate”:


Facebook will then give you an authorization code, which you only need for one-time use. Copy the code and run:

fbcmd auth [code]

If all goes well, you’ll receive a friendly “Welcome to FBCMD” message in your terminal. Finally, grant FBCMD default permissions with:

fbcmd addperm

This will take you to yet another web page, where you must hit the “Allow” button. Now you can proceed to using FBCMD.


All FBCMD commands start with fbcmd, followed by an argument. Simply type fbcmd to view all the possible commands. Some examples include:

  • Update your status:
    fbcmd status "I'm totally updating my Facebook status from the command line!"
  • Read your messages:
    fbcmd inbox
  • Post on your friend Buddy Pal’s wall:
    fbcmd wallpost "Buddy Pal" "Wanna rage this Monday night?"
  • RSVP to an event:
    fbcmd rsvp [event_id] yes|no|maybe

2. Twitter

Look no further than the Perl program TTYtter for your command-line Twitter experience. TTytter even supports the StatusNet and APIs in addition to Twitter.



Prereqisites include Perl 5.8.6 or newer and either Lynx or cURL. As of the day I’m writing this article, the latest stable version of TTYtter is 2.0.4 (from October 4, 2012). I recommend downloading the public beta (2.1) instead, as it is compatible with the latest changes in Twitter’s API. To get the beta, cd into your desired installation directory and run:

mv beta.txt ttytter
chmod +x ttytter

The authorization wizard will start in your terminal. Following the wizard’s instructions, visit the authorization page in your browser.


Generate the PIN and enter it in your terminal following the prompt. By default, the keyfile will be saved as “.ttytterkey” in your home directory.


If you installed TTYtter in a system directory such as /usr/bin, you can run it simply by typing ttytter. Otherwise, you’ll have to either specify the full path of the executable when you run it or add its directory to your $PATH environment variable. If your terminal supports ANSI colors, start TTYtter with ttytter -ansi.

The ttytter command lists recent posts from the users you follow and then opens an interactive session. At the prompt, you can type /help to list commands or /quit to exit. Here are some basic commands:

  • Make a status update by simply typing it into the prompt:
    I'm tweeting from my headless server!
  • Refresh to see the newest tweets from the users you follow:
  • Display a user’s profile information:
    whois [username]
  • View your replies and mentions:
  • Search Twitter:
    /search [term]

For more TTYtter commands and information about scripting TTYtter, see the official documentation. Happy tweeting!

Hungry for more ways to use the command line for social media? Stay tuned for Part 2!

Rebecca "Ruji" Chapnik

Ruji Chapnik is a freelance creator of miscellanea, including but not limited to text and images. She studied art at the University of California, Santa Cruz and writing at Portland State University. She went on to study Linux in her bedroom and also in various other people's bedrooms, crouched anti-ergonomically before abandoned Windows computers. Ruji currently lives in Portland, Oregon. You can find her experiments at and her comics at

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox