Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sometimes I would like to find a bookmarked URL for pasting it to a friend to Jabber (mcabber). Loading Firefox for that, then immediately closing it seems hugely overkill, I'd rather have a Linux CLI app that dumps all bookmarks to stdout and filter the results through grep. Of course, I can solve this by giving up completely on using bookmarks in Firefox and just save links to a simple text file, but I already have many ones.

Is there such a CLI app that can process a Firefox profile and dump bookmarks?

Should I instead aim to try automating somehow the export of Firefox bookmarks to a simpler (ideally plain text) format when it closes?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted
sqlite3 places.sqlite "select moz_places.url, moz_bookmarks.title
                       from moz_places, moz_bookmarks
                       where moz_bookmarks.fk = moz_places.id
                       and moz_bookmarks.type = 1
                       and length(moz_bookmarks.title) > 0
                       order by moz_bookmarks.dateAdded"

(Note: I suck at SQL.)

Add -line, -html, -separator " | ", or -separator $'\t' for alternate output formats.

share|improve this answer
add comment

The link below will automatically get you HTML and not plain text but it seems to work fine (I'm using 7.0.1) and you could probably use grep to parse out what you want.
http://en.kioskea.net/faq/2043-automatically-export-bookmarks-from-firefox

Which in a nutshell says to
use about:config (typed in the address bar) to set "browser.bookmarks.autoExportHTML" to true.

Update: I tried
grep -i http <PathToProfile>/bookmarks.html | awk '{print $2}'
and got a nice listing of bookmarked pages. This may take some tweaking and playing around but it works great.

share|improve this answer
    
awk '/http/{print $2}' –  grawity Oct 19 '11 at 11:27
    
Man I wish I took the time to understand awk better. Everything I have ever seen amazes me but it has never tipped the scales of actually making time to learn it. –  Dennis Oct 19 '11 at 11:55
add comment

The booknarks are already in html-format (with additional information) in your ~/.mozilla/firefox/xyz.default/bookmarks.html (xyz is some other string in your directory).

share|improve this answer
1  
My fresh install of Firefox (7.0.1) stores them in places.sqlite support.mozilla.com/en-US/kb/Profiles and only exports them on demand unless you set it to do so automatically. –  Dennis Oct 18 '11 at 21:19
    
@Dennis: Where do you set it to do automatically? –  vtest Oct 24 '11 at 10:10
    
@vtest: in about:config there is a key browser.bookmarks.autoExportHTML. Checkout the other keys containing bookmark too. –  ott-- Oct 24 '11 at 11:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.