Tuesday, August 29, 2017

Firefox Flem - solving the problem of Bookmarks remotely..

Hello... Most of us have the practice of bookmarking webpages... This post does not explain how to import or export bookmarks..

Read full to know more..

Recently I faced a problem where in - I had to fetch my bookmarks from  Google Chrome located at a remote machine. Unfortunately I had not taken a backup of my bookmarks.. Also I had only CLI ssh access to the machine..

What most of us do is that - we use browsers like Firefox and Chrome and we login to the browsers via an account(Chrome a/c for example) and that saves us from exports / import.

I dont have this practice.. So fetching my urls were much more difficult..

I googled to find out where the location of my bookmarks in Chrome stored in my /home location.

After finding it out... Which is: inside the respective home folder

.config/google-chrome/Default/Bookmarks [observe the . at the beginning]

I was kind of happy to find my Bookmarks.

2. The next problem was - the moment I gave cat Bookmarks

The file was in completely JSON format. I had around 97 URLs bookmarked.

3. How to fetch only the URLs from this file of JSON format was the next hurdle..

Shell commands to the rescue...

I issued the command:

cat Bookmarks | grep http

This output had enough amount of invalid characters as well... But it also fetched me https urls.. So the problem of http and https was solved..

Then the next command...

cat Bookmarks | grep http | wc -l [gave an output as 97 ]

4. Removing the invalid characters and only fetching the exact URL paths...

I now issued the command:

cat Bookmarks | grep http | cut -d : -f 2,3

This gave me all the list of URLs as 97 URLs.

5. Ok what next? How do I put them across to a text file?

It was pretty simple... cat Bookmarks | grep http | cut -d : -f 2,3 > urls.txt

... Concept of redirection..

6. Now how on earth would I put the urls.txt back to my existing browser in the local machine?

I cannot copy 97 URLs one after the other and save it yet again...?

7. Firefox Flem to the rescue..

This addon of Firefox can import a list of URLs or even a text file into its browser at one shot... !

Try Flem...

Let me know for any queries..

Tc,
Ananth G S