What's better than the command line and Facebook? How about combining the two?
Just because you’re stuck at the command line all day long doesn’t mean that you can’t participate in the awesomeness of social networking. You can enjoy both with FBCMD, the command line Facebook applications. Back in February, I wrote Tweeting from the Command Line with Twyt, which, as you remember, was an article covering the command line Twitter client, Tywt. Now, you can have your Facebook and the convenience of the command line to satisfy your social networking addiction. And, better still is that at the command line, no one will ever suspect that you’re Facebooking. Power to the people! The command line-using people, that is.
There are a few prerequisites for installing the command line Facebook application, FBCMD. PHP 5.x is a requirement, since the application is a single PHP file. You can install php5 via any method you wish but, in my experience, I had to install php5-cli, php5-gd, and php5-mysql to use this application. Your experience and mileage may vary.
Connect to the FBCMD and download the PHP file or grab it easily via curl.
$ curl -O https://github.com/dtompkins/fbcmd/raw/master/fbcmd_update.php
And, run the following two commands to complete this very simple installation.
$ sudo php fbcmd_update.php sudo
fbcmd update utility [version 2.91]
php fbcmd_update.php install
fbcmd update utility [version 2.91]
fbcmd version: [none] --> [1.0-beta5-dev1]
Note: fbcmd_update.php is now at [/usr/local/lib/fbcmd/fbcmd_update.php]
so you can remove the old one at [/home/khess/fbcmd_update.php]
type fbcmd to begin
As the prompt suggests, type fbcmd and see what happens.
Welcome to fbcmd! [version 1.0-beta5-dev1]
This application needs to be authorized to access your facebook account.
Step 1: Allow basic (initial) access to your acount via this url:
to launch this page, execute: fbcmd go access
Step 2: Generate an offline authorization code at this url:
to launch this page, execute: fbcmd go auth
obtain your authorization code (XXXXXX) and then execute: fbcmd auth XXXXXX
These messages explain the steps you need to take next to grant FBCMD access to your Facebook information.
Making the Facebook Connection
Perform the following connections from a Linux desktop system because some of these commands use Firefox (or your default browser) to initiate the connections and setup the application. Open a Terminal and type in the following commands.
fbcmd go access
Your Internet browser will open to Facebook and prompt you for login. If you see a link that reads, “Login with Command Line” or something similar, select that link and login to Facebook. If you don’t see that link, login to Facebook the way you normally do. Return to your Terminal window and issue the following command:
$ fbcmd go access
This command prompts another connection to Facebook, where you should see a six character code that you’ll need for the next step.
fbcmd auth XXXXXX
fbcmd [v1.0-beta5-dev1] AUTH Code accepted.
Welcome to FBCMD, Kenneth Hess!
most FBCMD commands require additional permissions.
to grant default permissions, execute: fbcmd addperm
As instructed, issue the command in the message.
$ fbcmd addperm
Your FBCMD to Facebook connection is now complete and you’re ready to use FBCMD. To test that assertion, try the following command to see the permissions you granted the application.
$ fbcmd showperm
A ’1′ means permission granted and a ’0′ means permission denied. You can change permissions at any time by issuing the addperm keyword and a permission. See the FBCMD Command Documentation for a complete listing of command keywords and syntax.
I can’t show you all of the FBCMD commands but I can show you a few of the fun ones. You can do almost anything with the command line interface that you can with the web interface. Your results may vary but generally speaking everything works pretty well. To see a list of your friends who are signed into Facebook, use fonline.
$ fbcmd fonline
Friend One idle
Friend Two idle
Friend Three idle
Friend Four idle
Friend Five active
Friend Six active
Friend Seven active
To see a list of messages that your friends have posted to your wall, use mywall.
$ fbcmd mywall
[#] NAME MESSAGE
 Friend One Hi , Hope you are good
You can read your Facebook messages with the inbox keyword.
$ fbcmd inbox
[#] FIELD VALUE
 subject [Hello]
:to/from Friend Four
:snippet Hi, what's up?
To check those annoying event invitations that people send you, use events.
$ fbcmd events
[#] START_TIME RSVP EVENT
 Wed May 25 02:00 not_replied Towel Day - Celebrating Douglas Adams
 Sat Jul 16 10:00 declined William Bernhardt Small-Group Seminar
And, last but not least, you can update your status. You wouldn’t want anyone to miss any aspect of your fascinating existence or your latest video game scores.
$ fbcmd post "This is a test post from FBCMD"
If you’re a PHP programmer, I suggest that you expand and extend this application by contacting the primary developer. See the Contribute page for more information.
For those of you who love to use Facebook, you’re sure to love an easy to install, easy to use command line Facebook application like FBCMD. FBCMD has a lot of potential as an evolving command line application that I hope someone incorporates into a repository so that it’s even easier to install for those who don’t like to install applications. Those of us who like a challenge are in the minority. Most people just want something that works and works without hassle or strain. Make it so, Linux fans.
Kenneth Hess is a Linux evangelist and freelance technical writer on a variety of open source topics including Linux, SQL, databases, and web services. Ken can be reached via his website at http://www.kenhess.com
. Practical Virtualization Solutions by Kenneth Hess and Amy Newman is available now.