Showing posts with label safari. Show all posts
Showing posts with label safari. Show all posts

Mar 3, 2011

Recovering Lost Data In Safari

While trying to recover lost data typed into a web page on Safari, I stumbled across this forum and one response was worth remembering for later:
"If you wish to open cache.db you'd use the sqlite3 command.
It comes with your mac and it's easy to use if you know SQL.
Open Terminal an type in:
"cd ~/Library/Caches/com.apple.Safari;sqlite3 cache.db".
it'll open up the database and you can type ".tables" to show
the table names  then ".output FILENAME" 
then "select * from TABLENAME;" and it'll output to the
desired file you could do "foo.txt" as the file name. I have
3 tables, cfurl_cache_blob_data, cfurl_cache_schema_version,
cfurl_cache_response, in it so i did the steps three times
starting with the .output command for three separate files..."
This is a handy way to search through your old safari data by dumping everything in a file and then grepping the contents. The exact commands I used to accomplish this were:
cd ~/Library/Caches/com.apple.Safari
sqlite3 cache.db
.output temp.txt
select * from cfurl_cache_blob_data;
It's kind of surprising to see what's actually in your cache! I had no idea that the pages I surf were being stored to this extent. Turned out to be very handy.

But scary.

Other useful commands:

.help
.schema cfurl_cache_blob_data
.exit