How to Use Facebook through the Command Line

Posted in:Tips 'n Tricks

A majority of Linux users prefer sticking to their terminal rather than accessing through a GUI for most of their daily tasks. Have you ever wondered whether there is any way to access Facebook from terminal? The answer is Yes... Now, its possible to access Facebook from the terminal.

fbcmd application gives you a command line interface for Facebook. Surprisingly , it is  available for Windows OS as well.

Installation of this app in Ubuntu/ Linux is pretty simple.

Make sure you have php installed in your system. If not, install as follows

sudo apt-get install php5 php5-cli

To test your PHP environment, try typing the following in the command prompt:

php -r "echo phpversion();"

While you're at it, make sure this outputs "1".

php -r "echo ini_get('allow_url_fopen');"

Download fbcmd.zip from the this link and Unzip the file

unzip fbcmd.zip
cd fbcmd

To finish the installation:

sudo php fbcmd_update.php 
sudo php fbcmd_update.php install

Type fbcmd to begin

fbcmd

Welcome to fbcmd! [version 1.0-beta5-dev1]

This application needs to be authorized to access your Facebook account.

You are almost done! This application needs to be authorized to access your Facebook account. This is a one time process.

Step 1: Allow basic (initial) access to your acount via this url, execute:

fbcmd go access

Facebook

Step 2: Generate an offline authorization code, execute:

fbcmd go auth

Command Line

Step 3: Obtain your authorization code (XXXXXX) and then execute:

fbcmd auth XXXXXX

Step 4: Most FBCMD commands require additional permissions. To grant default permissions, execute

fbcmd addperm

You are done !

To know the syntax , execute

fbcmd help

The following are a few commands that I found interesting..

How to list [and optionally save] all your friend's profile photos 

fbcmd ppics =all /tmp/fbcmd/ppics/

How to list [and optionally save] all photos where friend(s) are tagged

fbcmd fpics

How to list any friends who are currently online

fbcmd fonline

How to export all your friend's B'day date in csv format 

fbcmd finfo birthday_date -csv

How to know your profile ID 

fbcmd whoami

Update

How to set your status update

fbcmd status "is excited to play with fbcmd"

What not? Start playing with this app

fbcmd help #is your friend..

With this application, you can even schedule for a list of status updates to get posted in regular intervals with the help of a cron job :) Isn't that awesome? Start playing around with it and do let me know your feedback..

For additional help, examples, parameter usage, flists, preference settings,

Visit the FBCMD wiki:

Press the button below if you liked this site.
jeyanthan's picture

A Foss enthusiast. Follow me at @ijeyanthan on twitter

writeforus