6

I want to save all URLs of opened windows of google chromium in different text files with command line. In order to do that, I would need to know where google chromium stores their current google chromium URLs in Ubuntu 16.04 LTS.

Even though I want to write the script for chromium, I have tried this recommendation for Firefox and it didn't work. I couldn't find the sessionstore.js file anywhere.

pa4080
  • 30,621

3 Answers3

4

We can find which are Chromium's directories within user's home directory in this way:

find $HOME -type d -name *mium -exec echo {} \;

The result should be:

/home/<user>/.config/chromium
/home/<user>/.cache/chromium

Within the directory /home/<user>/.config/chromium/Default we can find couple of files that could be useful:

$ ls -1t $HOME/.config/chromium/Default | grep -i 'tabs\|sess'

Current Tabs
Current Session
Session Storage
Last Tabs
Last Session

The problem is that, unlike Firefox's log files Chromium's log files are not in readable format and it is hard to separate the tab's history from the current URLs.


However, within my Current Session I have two open tabs:

  • https://askubuntu.com/questions/970546/location-of-url-of-opened-tabs-of-google-chromium-in-ubuntu - that I've opened by a bookmark.

  • https://www.facebook.com/ - that I've opened by a bookmark, but then I've to login and then clicked to the FB logo.

I was able to achieve correct result by this ugly command:

$ cat -e $HOME/.config/chromium/Default/'Current Session' | sed -e 's/\^@/\n/g' -e '/_\/chrome/d' | grep -Po '(http|https)://\K.*' | sort -u

askubuntu.com/questions/970546/location-of-url-of-opened-tabs-of-google-chromium-in-ubuntu
www.facebook.com/?ref=logo

But when I open another tab and browse inside for a while the output of the above command become more fuzzy:

$ cat -e $HOME/.config/chromium/Default/'Current Session' | sed -e 's/\^@/\n/g' -e '/_\/chrome/d' | grep -Po '(http|https)://\K.*' | sort -u

askubuntu.com/questions/970546/location-of-url-of-opened-tabs-of-google-chromium-in-ubuntu
spidersport.com/forum/
spidersport.com/forum/index.php?sid=59f48a87db485e3a321aedbf7de68e6a
spidersport.com/forum/login.php
spidersport.com/forum/login.php?sid=59f48a87db485e3a321aedbf7de68e6a
www.facebook.com/
www.facebook.com/login.php?login_attempt=1&lwv=111
www.facebook.com/?ref=logo
www.spidersport.com/

Yes, the result is correct, because URLs of my open tabs are listed within, but there are also presented URLs from the browsing history.

pa4080
  • 30,621
3
$ perl -nwle '$h{$_}++ for /http[[:print:]]+/g; END{print for sort keys %h;}' \
~/.config/chromium/Default/Current\ Session

is a reworked version of @pa4080's (that I was unable to simply add as a comment.)

0

This command attempts to find HTTPS URLs associated with a current session of Chromium: Here I am finding unique strings containing the word https to get the history.

strings to read string in binary files, grep to find the strings with https in them and sort -u to print only their single occurence

strings $HOME/.config/chromium/Default/'Current Session' |grep https| sort -u