browser-cleanup

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

browser-cleanup

#1 Post by jpeps »

I just updated my way of cleaning out the browser cache and flash cookies from a mozilla file linked to my HD (for some reason, the mozilla link now works...which saves a lot of RAM).

The script is set for firefox, but could be adapted to seamonkey. "touch /tmp/mark" is added to the browser load script (eg, /usr/local/bin/defaultbrowser), so new cache files can be tracked and deleted with an "exit" script.

If I want to save cookies, I just exit the browser without the script. I also keep a mozilla backup for a pristine restore.

Exit script:

Code: Select all

#!/bin/sh

## mozilla directory
moz="/mnt/sda2/Desktop/.mozilla"

## close FF
VAR="$(ps | grep -v grep | grep "/firefox" | awk '{print $1}')" 

[ $VAR ] && kill -15 "$VAR"

## Remove Flash Objects:

rm -r /root/.macromedia/Flash_Player/\#SharedObjects/* 2>/dev/null 

if [ ! -f /tmp/mark ]; then
echo "First create: /tmp/mark"
exit
fi 

## Find new cache files & delete  

find "$moz" -type f -newer /tmp/mark | grep "Cache"  >/tmp/list 

while read line; do
rm "$line"
done </tmp/list


Here's a log for files deleted after a 2 minute session (BTW/ setting prefs to delete cookies upon exit didn't help a bit :) ).

Code: Select all

.macromedia/Flash_Player/#SharedObjects/P88B3T5F

.mozilla/firefox/h4iu7wbo.default/Cache/E/C7/2504Dd01
.mozilla/firefox/h4iu7wbo.default/Cache/E/44/100CCd01
.mozilla/firefox/h4iu7wbo.default/Cache/_CACHE_MAP_
.mozilla/firefox/h4iu7wbo.default/Cache/D/28/700BFd01
.mozilla/firefox/h4iu7wbo.default/Cache/D/E8/99C81d01
.mozilla/firefox/h4iu7wbo.default/Cache/5/0E/34AD1d01
.mozilla/firefox/h4iu7wbo.default/Cache/4/A7/470EEd01
.mozilla/firefox/h4iu7wbo.default/Cache/9/5A/5BC03d01
.mozilla/firefox/h4iu7wbo.default/Cache/_CACHE_002_
.mozilla/firefox/h4iu7wbo.default/Cache/3/C5/F36B1d01
.mozilla/firefox/h4iu7wbo.default/Cache/F/FC/1BCE4d01
.mozilla/firefox/h4iu7wbo.default/Cache/F/3D/CA8CEd01
.mozilla/firefox/h4iu7wbo.default/Cache/C/8B/960A1d01
.mozilla/firefox/h4iu7wbo.default/Cache/C/1D/E0284d01
.mozilla/firefox/h4iu7wbo.default/Cache/_CACHE_001_
.mozilla/firefox/h4iu7wbo.default/Cache/2/51/2B973d01
.mozilla/firefox/h4iu7wbo.default/Cache/2/07/F4C3Ad01
.mozilla/firefox/h4iu7wbo.default/Cache/_CACHE_003_

User avatar
puppyluvr
Posts: 3470
Joined: Sun 06 Jan 2008, 23:14
Location: Chickasha Oklahoma
Contact:

#2 Post by puppyluvr »

:D Hello,
What sbout the huge sqlite files??
Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!

Puppy since 2.15CE...

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#3 Post by jpeps »

puppyluvr wrote::D Hello,
What sbout the huge sqlite files??
The large file is urlclassifier3.sqlite. If you delete it'll just reinstall itself again every time you load the browser (it's allegedly a list of phishing sites used for security purposes). Places.sqlite is your bookmarks, annotations, etc.

I'd recommend leaving them alone for regular use, but you can always delete them or copy over your backup.

The biggest mistake is to have both Seamonkey and Firefox in your .mozilla folder. Deleting an unused brower will cut the size in half.

User avatar
Barkin
Posts: 803
Joined: Fri 12 Aug 2011, 04:55

Re: browser-cleanup

#4 Post by Barkin »

jpeps wrote: cleaning out ... flash cookies from a mozilla
There's an app for that ... https://addons.mozilla.org/en-US/firefox/addon/betterprivacy/

It gives you the option to save some flash cookies whilst deleting the rest.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#5 Post by sunburnt »

Hi all; Vovchik told me about this trick for PCs with less than 1 GB of ram:
In Firefox address bar type: about:config
It will warn you, click button to access the configuration screen.
Find these 2 lines and double click them to disable ( false ) them:

Code: Select all

browser.cache.disk.enable;false

browser.cache.memory.enable;false
There`s other lines associated with these, but I haven`t tried them.
I think they only matter if these lines are enabled.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#6 Post by technosaurus »

Code: Select all

#!/bin/sh
#killall firefox seamonkey-bin #I don't think killing is necessary???
for x in $HOME/.mozilla/*/*/cookies.txt ; do
	while read A || [ "$A" ] ; do
		case $A in 
#only save cookies from these sites
			*murgalinux.com*|*puppylinux.*)echo "$A";;
			*.xxx*)echo you naughty puppy >/dev/stderr;;
			*)echo removing $A >/dev/stderr;;
		esac
	done <$x >$x~
mv -f $x~ $x
done

rm -rf $HOME"/.macromedia/Flash_Player/\#SharedObjects/"* 2>/dev/null

echo cookies removed
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#7 Post by 01micko »

technosaurus wrote:

Code: Select all

			*.xxx*)echo you naughty puppy >/dev/stderr;;
			
hmmm.... :lol:
Puppy Linux Blog - contact me for access

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#8 Post by technosaurus »

thought about using this for *.microsoft.com*|*.bing.*)...

Code: Select all

rxvt_hold() { rxvt -bg blue -fg white -e sh -c " ${*} ; read " ; } 
center_msg(){ MSG="$@"; echo -e "\033[$((`tput lines`/2));$(((`tput cols`-${#MSG})/2))H $MSG" ; }
export -f center_msg

...

*.microsoft.com*|*.bing.*|*.hotmail.com*)
rxvt_hold "center_msg What did you think would happen if you visited an Microsoft site?"
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply