1

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?

4 Answers 4

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

2

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.

2
  • awk '/http/{print $2}' Commented Oct 19, 2011 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
    Commented Oct 19, 2011 at 11:55
1

FWIWI, I just came across https://github.com/zefr0x/foxmarks . I haven't tried it yet but it looks like it's exactly what OP asked for (12 years ago, admittedly).

0

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

3
  • 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
    Commented Oct 18, 2011 at 21:19
  • @Dennis: Where do you set it to do automatically?
    – vtest
    Commented Oct 24, 2011 at 10:10
  • @vtest: in about:config there is a key browser.bookmarks.autoExportHTML. Checkout the other keys containing bookmark too.
    – ott--
    Commented Oct 24, 2011 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .