Linux Social Media

Access Facebook From The Linux Command Line

Danny Stieben 10-09-2012

facebook linux command lineVirtually everyone, especially in first world countries, is on Facebook. Friends, events, pictures, and plenty more are all commonly found on Facebook unlike any other location. However, an ultimate geek may not want to use Facebook like everyone else — namely via their website.


Certain geeks are very familiar with the Linux command line. If you’ve a newbie, you can check out our ultimate guide to Linux Getting Started With Linux and Ubuntu You're interested in switching to Linux... but where do you start? Is your PC compatible? Will your favorite apps work? Here's everything you need to know to get started with Linux. Read More to learn more. Anyone into the Linux command line will love using the command line to access the Facebook social network. This sounds like an impossible feat, but a PHP script is making it all possible.

About fbcmd

fbcmd is a simple PHP script (well, simple when compared to the actual Facebook website) which allows you to perform actions on Facebook via the script, as if the script were a natively installed application. You can then pass commands to the program, as well as any other flags or optional information as you’re used to from most other command-line programs.


To use the script, you’ll need to make sure that you have some PHP modules installed. Under Ubuntu, you can install them by issuing the command sudo apt-get install php5-cli php5-curl. Other Linux distributions should have similar commands with similar package names. Once those modules are installed, you can download fbcmd from this link here (right click it and choose Save As) or by issuing the command wget Once that file is downloaded, go ahead and run sudo php fbcmd_update.php install.

Setting Up

facebook linux command line
Using fbcmd requires that you’re authenticated with Facebook, but fbcmd doesn’t use traditional login credentials. Instead, you’ll need to go through a setup process to get going. First, run fbcmd and you’ll see some instructions printed into the terminal on getting started. First type fbcmd go access to open up a connection to Facebook, then fbcmd go auth to launch a browser with an authentication code based on your Facebook account.

facebook command line
Then type fbcmd auth [code], replacing [code] with the actual generated code. You can then add permissions for fbcmd using fbcmd addperm, and check permissions using fbcmd showperm.



facebook linux command line
Now that you’re finally set up, it’s time to do some things with fbcmd. To post a new status, use fbcmd status [message]. If you’d like to see the posts others have made on your wall, use fbcmd mywall. fbcmd friends returns a list of all your friends, but you can also search for specific friends by using fbcmd friends "[string]" (remove the square brackets but include the quotation marks). To see who’s currently online, use fbcmd fonline. You can show the last x amount of messages in your inbox by using fbcmd inbox X, of course replacing the X with a number. To check out your news feed, using fbcmd stream, and like a post using fbcmd like [post ID]. To upload a picture to Facebook, use fbcmd addpic [path of image] [optional album ID] [optional tag].


All in all, it’s pretty cool to be able to do all this with Facebook directly from the command line. Of course, this method of accessing Facebook isn’t for everyone, and is more for the big-time geeks or for showing off. So use this if you dare, but it’s pretty cool once it’s successful.

How cool is using Facebook over a command line to you? What would be your favorite way to access Facebook? Let us know in the comments!

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. pony
    November 8, 2012 at 7:09 pm

    Here is a video on fbcmd:

  2. Rudy
    September 21, 2012 at 7:39 pm

    Its pretty cool using the fbcmd. but, how can i see more than just 10 streams at a time? (:

  3. Darryl
    September 11, 2012 at 7:38 am

    fbcmd rocks! I used it to automate some quick and dirty scripts to copy the latest photos my wife takes and posts to Facebook and publish them on her personal website. I don't even know if the Facebook API allows for this kind of access, so it was great to just do it with some PHP scripts.

    • Danny Stieben
      September 19, 2012 at 1:46 am

      fbcmd should make it much easier to upload those pictures to your wife's profile!

  4. Shreya Dahal
    September 11, 2012 at 6:07 am

    I once tried opening Facebook in the terminal using Links. It opens a Incompatible Browser page and says:
    "Sorry, we are not cool enough to support your browser. Please keep it real with one of the following browsers:
    * Mozilla Firefox
    * Google Chrome
    * Safari
    * Microsoft Internet Explorer"

    • Danny Stieben
      September 19, 2012 at 1:44 am

      Yeah, sadly Facebook isn't cool enough for Links. But fbcmd uses Facebook's API, which is why it still works.

  5. Prashant Mohta
    September 11, 2012 at 6:00 am

    I guess it would be use full to make applications that need to think and do stuff on Facebook without the need to make your own interface with the API

  6. Ahmed Khalil
    September 11, 2012 at 5:43 am

    But i can accept this for fun only, sorry but it is difficult for me now to dgo back to the world of DOS

    • Danny Stieben
      September 19, 2012 at 1:43 am

      The main point of this method is to use it for fun or for those absolute die-hard command line lovers.

  7. Ahmed Khalil
    September 11, 2012 at 5:42 am

    we go back to the stone age, it is strange to work with this thing, as linux now has GUI too

  8. GrrGrrr
    September 10, 2012 at 5:53 pm

    wow, thins is going to bring some fun to rather boring Linux..;)

  9. Miggs15
    September 10, 2012 at 5:19 pm

    Curses apps are indeed sexy, lightweight and more reliable after you master the commands or hot keys. This could be a nice addition but I don't find myself using facebook much these days.

    • Danny Stieben
      September 19, 2012 at 1:42 am

      I'm glad you like this method!