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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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



List last opened tabs in firefox browser

Terminal - List last opened tabs in firefox browser
grep -Eo '"entries":\[{"url":"[^"]*"' "$HOME/.mozilla/firefox/*.default/sessionstore.js" | sed 's/^.*:"//; s/"$//'
2010-08-30 14:30:21
User: bandie91
Functions: grep
List last opened tabs in firefox browser


There is 1 alternative - vote for the best!

Terminal - Alternatives
F="$HOME/.moz*/fire*/*/session*.js" ; grep -Go 'entries:\[[^]]*' $F | cut -d[ -f2 | while read A ; do echo $A | sed s/url:/\n/g | tail -1 | cut -d\" -f2; done
2009-05-21 21:58:42
User: b2e
Functions: cut echo grep read sed tail

Tuned for short command line - you can set the path to sessionstore.js more reliable instead of use asterixes etc.

Usable when you are not at home and really need to get your actual opened tabs on your home computer (via SSH). I am using it from my work if I forgot to bookmark some new interesting webpage, which I have visited at home. Also other way to list tabs when your firefox has crashed (restoring of tabs doesn't work always).

This script includes also tabs which has been closed short time before.

Know a better way?

If you can do better, submit your command here.

What others think

The 'grep path/to/sessionstore.js sed' by bandi91 does work after these diff:

- "\$HOME

+ "$HOME

and replace the joker with the real full path (I eventualy ried every joker combinaison with no luck).

Otherwise cool & KISS example.

Comment by datruche 124 weeks and 5 days ago

@datruche You are right, quoted wildcard char does not work. I rather say now:


so quote only "$HOME", not the rest of the path. however quoting HOME variable is almost unneccessary and it is only a habit to avoid whitespace in any shell variable.

ad 2nd, you suggest not to escape leading dollar, but I can not see escaped dollar in my snippet.

Comment by bandie91 124 weeks and 5 days ago

@bandie91, hmm works fine in Firefox:

> quote only "$HOME"

And for Palemoon if adding 2 jokers:


As for the leading dollar escape I can't remember.

Comment by datruche 120 weeks and 1 day ago

Your point of view

You must be signed in to comment.