Herry Kusmadi
Herry Kusmadi

Reputation: 1361

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?

Upvotes: 110

Views: 76208

Answers (10)

Juan Rangel
Juan Rangel

Reputation: 1793

You can do that now easily with

  1. cmd + shift + p
  2. Type "clear"
  3. Choose Clear console history

enter image description here

Upvotes: 2

Diwakar
Diwakar

Reputation: 938

This is very simple, just right click the console window and select Clear console history, then refresh the page.

Please note, refreshing/reloading that tab is required.


enter image description here

Upvotes: 14

vitch
vitch

Reputation: 3214

I ended up here looking for how to do the same thing in Firefox.

In case anyone else does the same, there is a clearHistory command in the Firefox console which will do just that.

https://developer.mozilla.org/en-US/docs/Tools/Web_Console/The_command_line_interpreter#Helper_commands

Upvotes: 4

Clay Morton
Clay Morton

Reputation: 330

These shortcuts Clear Console.

⌘ K or Ctrl L

Upvotes: -1

jurl
jurl

Reputation: 2802

I found a quick way to do this with cool keyboard shortcut:

Inside chrome console

  1. Press Ctrl + Shift + P
  2. You will see this awesome command palette opened: chrome devtools command palette
  3. type clear and you will find it :) chrome devtools: clear console history

That's it!

Upvotes: 74

Jeff Lamb
Jeff Lamb

Reputation: 5865

You can now just right click on the console area and select "Clear console history".

enter image description here

Upvotes: 247

asiby
asiby

Reputation: 3399

If you don't want to have this console history (like myself), simply disable it from the devtool's configuration options (see on the image) below ...

enter image description here

Upvotes: 11

DutchKevv
DutchKevv

Reputation: 1699

It can also be fixed by going to the developer tool settings and resetting to defaults.. (this will not reset 'Chrome', only developer tools options)

  • Open Chrome devtools
  • Go to settings (or press Windows ->F1 / OS X -> FN + F1)
  • Reset to the defaults

This way you will lose your developer settings, but for me the only thing that mattered was turning cache off again..

Upvotes: 0

Rob W
Rob W

Reputation: 349262

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.

Upvotes: 137

mjkaufer
mjkaufer

Reputation: 4216

Simply enter clear() in the chrome console to remove all previous text there.

Upvotes: 3

Related Questions