Search code examples
google-chrome-devtools

How to clear console history


It's possible to browse the commands previously run in the console by pressing the up and down arrow keys. I want to clear this history. How can I do this?


Solution

  • If you want to clear the list of last typed commands, follow these steps:

    (Step 1 and 2 are important, don't skip them!)

    1. Undock the console (click on the icon in the bottom-left corner, undock icon).
      (if you don't see the undock icon, but , then hold the mouse pressed for a few seconds to get the desired icon)
    2. Press Ctrl + Shift + J to open the console for this console. (On OSX use Cmd + Option + i)
    3. Go to the Resources tab, "Local Storage", chrome-devtools://devtools.
    4. Right-click on the item with key "consoleHistory", and choose "Delete". chrome-devtools://devtools -> consoleHistory -> Delete

    5. Done! You may close the new console, and then dock the previous one if wanted. The console history will be gone when you reload the console.

    If you just want to clear the console log (not the commands), just press Ctrl + L.

    You could also use Incognito mode if you don't want to keep the list of commands you're going to type.