How To Access Facebook From The Command Line [Linux]

Last time, we show you how to tweet from the command line. But if you are more of a Facebook person and that you also want to look cool with the console, you might wonder if the same solution exists for you. The answer is yes!

fbcmd is a little PHP software that allows you to access your Facebook account from the command line. Except for a few missing features, fbcmd is incredibly complete.

There are no packages available yet for your distribution (except for Arch) so you will have to install the program manually.

sudo apt-get install php5-cli php5-curl

You will then have to download fbcmd with that:

wget https://raw.github.com/dtompkins/fbcmd/master/fbcmd_update.php

Initialize the installation:

php fbcmd_update.php

And finally install it:

sudo php fbcmd_update.php sudo
php fbcmd_update.php install

The whole process is explained in the official wiki, you can also visit the troubleshooting page in case of problem, or even leave a comment.

And just when you thought that you were done, trying to launch the program from the console with

fbcmd

you should get something like this

fbcmd-auth_error

As you can read, you have to grant authorization to fbcmd at multiple levels. Basically, launch

fbcmd go access

And give the basic authorization. Then, type:

fbcmd go auth

You should generate a code that you copy paste into

fbcmd auth [code]

Finally, manage the permissions with

fbcmd addperm

You can always check which permissions were granted with

fbcmd showperm

Pretty tedious I give you that, but at least you know what you are doing. Fbcmd is now ready to be used.

The general syntax for using fbcmd is

fbcmd [command] [parameters] -[preference]=[value]

The keyword here is “command.” As I said before, except for a few missing features, fbcmd is very complete. What I really mean is that you can do as much as with the web interface, except for sending private messages, pokes, or accept friend requests.

Since you can do so much, let me give you a few examples of what you may want to do first. I invite you to search on your own if you want to perform a specific action.

  • To change your status, type
fbcmd status [new status]

(note that you can tag some by putting his name after a ‘@’ in the message)

  • To show the posts from others on your wall, use
fbcmd mywall
  • To see all your friends, try
fbcmd friends

This also embodies the search function, as you can precise a string sequence as an argument and it will return the friends with that string in their name.

fbcmd friends "[string]"

And if you just want to know who is online, the command is

fbcmd fonline
  • To display the last X messages in your inbox, the syntax is
fbcmd inbox X
  • To check out the stream stories, use
fbcmd stream

You can then like any post with

fbcmd like [post ID]
  • To add a picture, type
fbcmd addpic [path to the picture] [optional album ID] [optional tag]

As you can see, fbcmd is very interesting to use. It remains very complex, and I guess that the command line is more appropriate for something simpler, like Twitter. But it still remains super cool to access Facebook that way. However, the program heavily depends on the official API which means that the functions can be modified by Facebook itself. Right now, the policy does not let us accept friends via the API, but that might change in the future.

What do you think about fbcmd? How do you compare it to TTYtter? Do you have any questions? Please let us know in the comments.

Do you like what you read here?

Receive the latest update in your inbox.

Or connect with us: