Access Facebook From The Linux Command Line

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.

Instead, the most geeky way to access the social network is to use the command line. 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.

Prerequisites

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 https://raw.github.com/dtompkins/fbcmd/master/fbcmd_update.php. 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.

Usage

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].

Conclusion

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!


MakeUseOf Recommends

Danny Stieben

Danny is a junior at the University of North Texas who enjoys all aspects of open source software and Linux. He is also a contributor for the Fedora Project. You can check out his personal website or follow his Twitter account here.

The comments were closed because the article is more than 180 days old.

If you have any questions related to stuff mentioned in the article or need help with any computer issue, just ask it on MakeUseOf Answers.

Hide 13 Comments

  • Miggs15 September 10, 2012
    0 likes

    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.

    | Like
    • Danny Stieben September 19, 2012
      0 likes

      I’m glad you like this method!

      | Like
  • GrrGrrr September 10, 2012
    0 likes

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

    | Like
  • Ahmed Khalil September 11, 2012
    0 likes

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

    | Like
  • Ahmed Khalil September 11, 2012
    0 likes

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

    | Like
    • Danny Stieben September 19, 2012
      0 likes

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

      | Like
  • Prashant Mohta September 11, 2012
    0 likes

    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

    | Like
  • Shreya Dahal September 11, 2012
    0 likes

    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”

    | Like
    • Danny Stieben September 19, 2012
      0 likes

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

      | Like
  • Darryl September 11, 2012
    0 likes

    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.

    | Like
    • Danny Stieben September 19, 2012
      0 likes

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

      | Like
  • Rudy September 21, 2012
    0 likes

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

    | Like
  • pony November 8, 2012
    0 likes

    Here is a video on fbcmd: http://www.youtube.com/watch?v=cxudGA9VFXk

    | Like