Quick summary
For Ubuntu, jump down to The final "one-liner"
section at the bottom.
Details
This is modeled after @Andrey Bezpalenko's answer, but tested to be functional also on Ubuntu 18.04.
As is the case with his answer too, however, the output is pretty stinking ugly, as it's binary output with readable ASCII character strings intermingled in with the binary. Here are the steps:
Find the latest log file (*.log) in the "Platform Notifications" directory for your Chrome installation:
find ~/.config/google-chrome | grep --extended-regexp \
"google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1
Sample Output:
$ find ~/.config/google-chrome | grep --extended-regexp "google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1
/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log
We can see we found the log file here: /home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log
.
View the last, let's say, 10 lines, or log entries, from this log file:
tail -n 10 "/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log"
Sample output of just the last 3 items (tail -n 3 "/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log"
). Notice how flippin' ugly this is to try to read and interpret!
$ tail -n 3 "/home/gabriel/.config/google-chrome/Default/Platform Notifications/000003.log"
o"link"dhttps://www.reddit.com/r/AskReddit/comments/est2b4/what_would_be_the_worst_thing_to_put_in_a_pi�ata/"correlation_id"$1b7b2ef8-3ebb-4532-81ec-f896e58edaff"
message_type"lifecycle_post_suggestions" device_id"@a5df86650804f98993acc43b31efa4ec0c733485b8cef4d8fe64a01ad07e9e09"auto_dismiss_optionsobehavior"timed"dismiss_time_msI��{{X`�������hrz* p#https://www.reddit.com/#01019308@H����P�-X�-`�-hp���-��<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193�_Q��<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193�
��<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193��,����DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg�https://www.youtube.com/"�
SpaceX In-Flight Abort Test"Recommended: NASA Video*�SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`�������hrz*�p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H�������hp�q�I���DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg�https://www.youtube.com/"�
SpaceX In-Flight Abort Test"Recommended: NASA Video*�SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`�������hrz*�p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H�������`�hp������DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg�RESOURCES:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
Or, just do all of the above in one single step
tail -n 10 "$( find ~/.config/google-chrome | grep --extended-regexp "google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1 )"
Or even better, also print out the path to the log file:
The final "one-liner"
LOG_FILE="$( find ~/.config/google-chrome | grep --extended-regexp \
"google-chrome.{0,30}Platform Notifications.*\.log$" | tail -n 1 )"; \
echo -e "LOG_FILE=\"$LOG_FILE\"\n---------\n"; tail -n 10 "$LOG_FILE"
Further work
Can anyone make this output look less horribly ugly? I'd like to see prior notifications in a more readable format!
Update 25 May 2020:
Here's one step closer to something useful: after running the "final one-liner" above, do this to extract just the ASCII chars from the binary, and remove extraneous spaces.
strings "$LOG_FILE" | sed -E 's/[ ]{8,}/\n/g'
First, strings
extracts ASCII strings from the binary file. Then, the "'s'tream 'ed'itor", sed
, 'g'lobally replaces all instances of 8 or more spaces in the 's'tring with a newline char, \n
, since I noticed there were dozens if not hundreds of spaces in a row sometimes, which dramatically reduced readability. The -E
in sed
is to allow 'E'xtended regular expression searches.
Note that the one-liner command above already stored the file path into the LOG_FILE
variable, so we are just going to re-use that variable here. See echo "$LOG_FILE"
if you need to see what that variable holds.
After doing the above, you'll get something like this:
$ strings temp.txt | sed -E 's/[ ]{8,}/\n/g'
o"link"dhttps://www.reddit.com/r/AskReddit/comments/est2b4/what_would_be_the_worst_thing_to_put_in_a_pi
ata/"correlation_id"$1b7b2ef8-3ebb-4532-81ec-f896e58edaff"
message_type"lifecycle_post_suggestions" device_id"@a5df86650804f98993acc43b31efa4ec0c733485b8cef4d8fe64a01ad07e9e09"auto_dismiss_optionsobehavior"timed"dismiss_time_msI
{{X`
hrz* p#https://www.reddit.com/#01019308@H
<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193
<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193
<DATA:https_www.reddit.com_0p#https://www.reddit.com/#010193ARESOURCES:https_www.reddit.com_0p#https://www.reddit.com/#010193
DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
https://www.youtube.com/"
SpaceX In-Flight Abort Test"Recommended: NASA Video*
SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`
hrz*
p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H
DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
https://www.youtube.com/"
SpaceX In-Flight Abort Test"Recommended: NASA Video*
SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAo"nav"B/watch?v=mu5Ydz34oVc&feature=push-fr&attr_tag=WQZST9cYBH8yY01w%3A6"id"COvK+bnsmucCEJQB"attributionTag"WQZST9cYBH8yY01w:6{X`
hrz*
p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg08@H
DATA:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
RESOURCES:https_www.youtube.com_0p#https://www.youtube.com/#1SpaceX In-Flight Abort TestRecommended: NASA Videohttps://lh4.googleusercontent.com/-yGgyfF0s0tA/AAAAAAAAAAI/AAAAAAAAAAA/kiuOchD_wtI/s96-mo/photo.jpg
References
sed
:
- explains how to use regex groups () and \1 \2 \3 etc to reference those groups! - Unix & Linux: Using sed to find and replace complex string (preferrably with regex)
- How to use sed to find and replace text in files in Linux / Unix shell - https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/
chrome://notifications
and they don't make it to the OS.