Where is Chrome’s debugger console command history stored?

I often use Chrome’s debugger console for experimenting with javascript code fragments. When I got it right I usually want to copy the needed commands into my script, but here is where it gets messy. The is no filter options for commands and no way to call certain commands back (like with Ctrl-R in Bash) so you need to step through all the commands in the history and copy the commands you want one by one.

Instead, I think it should be possible to retrieve the command history from some file or Sqlite database. But I can’t find it.

So my question is: Where is Chrome’s debugger console command history stored?


I found an answer here: How to access firefox web console command history?

I had some trouble getting it working, but here is how I did.

Open the developer console (shift-ctrl-I). Then open that console in a new window if it isn’t that already by using the menu in the upper right (the three dots).

When it is a separate window, press shift-ctrl-I again. Then paste something like this:

var hist = JSON.parse(localStorage.consoleHistory);

Now, with all the commands in the console you can either copy them all to the clipboard or use the filter field above the console to do some filtering on them (you can use regex).

Leave a Reply

Your email address will not be published. Required fields are marked *