Monday, June 17, 2013

Firefox: Where's My Bookmark (From the Console?)

I'm a slightly OCD type person. I'll check something several times over so the state of said thing is burned indelibly into my memory, and I can recall it later to that specific moment and not mix it up with some other similar time. For example, I'll check the refrigerator door before leaving the apartment several times to make sure it's shut, lest I worry on the subway that the fridge is acting as an apartment air conditioner.

Sometimes I end up with an irrational focus on something that shouldn't be a worry. I knew I had worked out some vacation time on the calendar, but for some reason I decided I wanted to double check it was actually entered into the private company vacation list. I needed the URL, which I had saved as a bookmark in Firefox on my OS X workstation. On my desk. Which was about 150 miles away.

That workstation didn't have graphical interface access open, but did have SSH. So how can I extract the address from the console?

I VPN'ed into the corporate network then SSH'd into the workstation. Next I navigated to the Firefox profile, located in ~/Library/Application Support/Firefox/Profiles/<something>.default.

Next I changed directories into ./bookmarkbackups. Is this automatically generated? I'm not sure. I just know there were several JSON files with dates in the filenames located in that directory.

As a quick and dirty operation, I dumped the text to my console then copy and pasted it into a text editor. The file was a list of titles, changed datestamps, URI's, etc...so a quick search within the text document for the name of the calendar turned up in the bookmark title lists. From there I copy and pasted the URI into the web browser...tada!

And that is how I pulled the address of a website from my Firefox bookmarks using the command line!

No comments:

Post a Comment