What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Universal configuration monitoring and system of record for IT.

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Psst. Open beta.

Wow, didn't really expect you to read this far down. The latest iteration of the site is in open beta. It's a gentle open beta-- not in prime-time just yet. It's being hosted over at UpGuard (link) and you are more than welcome to give it a shot. Couple things:

  • » The open beta is running a copy of the database that will not carry over to the final version. Don't post anything you don't mind losing.
  • » If you wish to use your user account, you will probably need to reset your password.
Your feedback is appreciated via the form on the beta page. Thanks! -Jon & CLFU Team

View facebook friend list [hidden or not hidden]

Terminal - View facebook friend list [hidden or not hidden]
lynx -useragent=Opera -dump 'http://www.facebook.com/ajax/typeahead_friends.php?u=4&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2
2010-01-29 15:10:35
User: vlan7
Functions: cut gawk grep
View facebook friend list [hidden or not hidden]

There's no need to be logged in facebook. I could do more JSON filtering but you get the idea...

Replace u=4 (Mark Zuckerberg, Facebook creator) with desired uid.

Hidden or not hidden... Scary, don't you?


There are 5 alternatives - vote for the best!

Terminal - Alternatives
php -r "echo ini_get('allow_url_fopen');" php -r "echo function_exists('curl_init');" php -r "echo function_exists('json_decode');"
2013-11-23 08:56:52
User: kashanpk

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

php -r "echo function_exists('curl_init');"

php -r "echo function_exists('json_decode');"

fbcmd FSTATUS =all

Know a better way?

If you can do better, submit your command here.

What others think

uhm.. this may sound stupid, but how do i get my (anyone elses) userid?

all facebook displays is a username (e.g. in my case 'drazraeltod') that doesn't seem to work

another question: why using lynx instead of wget or curl? did i miss something important?

Comment by DrAzraelTod 343 weeks and 4 days ago

ah.. forget the last part of the question...

i just found a friend without username and he has of course my id in his list :-)

Comment by DrAzraelTod 343 weeks and 4 days ago

We could use wget / curl. No problem. It's our choice. But don't forget to specify the user-agent. Facebook only accepts well-known user-agents...

i.e. if we use wget we should type this syntax:

wget -O - --user-agent='Opera' (...)

P.S. You could also find your uid just placing the mouse cursor on your profile avatar ;)

Comment by vlan7 343 weeks and 4 days ago

Only works if you have the "Public Search Results" checkbox checked, as it apparently makes all this info public.

*unchecks box* didn't know it did that. It certainly doesn't imply it's making all that info public. Gee, thanks, Facebook.

Comment by Groxx 343 weeks and 3 days ago

Dear Groxx,

This must has been changed on facebook 1-2 days before today, because in my previous tests I checked it with my own uid (that always had "public search results" box unchecked) and it always have worked well.

Today I try it one more time and this has changed :)

Anyway, as you sign "Facebook" on your post, thanks to you and all Facebook team for changin' this and to not categorize nevermore the friend list as PAI (Public Information Available), as you name it in Facebook privacy terms ;)

Oh, thanks for remove this:

"when it is viewed by people who are logged in to Facebook. Keep in mind, however, that because Friend List is publicly available, it will be visible to people who are viewing your profile while not logged in."


Best regards,

Comment by vlan7 343 weeks and 3 days ago

Online tool to view anyone?s Facebook friends list (hidden or not) based on a user ID: http://mathiasbynens.be/examples/facebook-friends

Comment by mathias 343 weeks and 3 days ago

@vlan7: Groxx is not signing as "Facebook", but rather addressing them in the same manner as "Thanks for the lynx command, vlan7."

Comment by dennisw 343 weeks and 3 days ago

oh! I misunderstood Groxx :$ sorry, I'm not native english.

Comment by vlan7 343 weeks and 2 days ago

This seems to not work with users who have pages using other locales, eg. ru-ru.facebook.com or es-la.facebook.com

also, mathias, your online form has a bug, it always counts and shows Mark Zuckerberg's ID before listing the friends for the ID you choose.

Comment by monkeyvegas 343 weeks ago

Is there a way to get only online friends?

Comment by RanyAlbeg 341 weeks and 6 days ago

When I try this, facebook refuses it because I'm using lynx and, as you said, they only accept well-known user-agents... But I specified Opera as indicated, so I don't see what could be going wrong. Any idea what I should do?

Comment by dcurl34hy 334 weeks and 3 days ago

I keep getting an error message when I try to run this. I am a total newbie and trying to learn here. I get "__a is not recognized as an internal etc.." What am I doing wrong?

Comment by RLCowboy 327 weeks and 5 days ago

Try this:

wget -O - --user-agent='Opera' 'http://www.facebook.com/ajax/typeahead_friends.php?u=7&__a=1' |gawk -F'\"t\":\"' -v RS='\",' 'RT{print $NF}' |grep -v '\"n\":\"' |cut -d, -f2


Comment by vlan7 320 weeks and 4 days ago

im a newbie how can i use this??

Comment by angel76 315 weeks and 1 day ago

Vlan7, I keep getting the same mssage as RLCowboy along the lines of "__a is not recognized as an internal..."! I tried typing in just the facebook ajax typeahead address alone, but I only get something about 0 out of 0.

Do you have a different command that works? Any other ways I could try your original command differently using wget? I really want this to work! Please help, Vlan7! Thank you!

Comment by toulseu 309 weeks and 5 days ago

@DrAzraelTod: to get a number ID just try http://graph.facebook.com/USERNAME

Now, most of fb users have a username and fb doesn't show their ID...

And, regarding this link: is not showing hidden friends anymore :(

Comment by Ferdelanze 253 weeks and 5 days ago

its possible



Comment by rahmanp786 246 weeks and 2 days ago

Your point of view

You must be signed in to comment.