Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear console with command

Like this is my console currently with lots of line in it

enter image description here

Is there any javascript or jquery command with which i can clear the console.

I don't want to hit clear button with mouse. Only a code command is required.

like image 839
Gaurav Aggarwal Avatar asked May 04 '16 08:05

Gaurav Aggarwal


People also ask

How do I clear the console screen?

You can use Ctrl+L keyboard shortcut in Linux to clear the screen. It works in most terminal emulators. If you use Ctrl+L and clear command in GNOME terminal (default in Ubuntu), you'll notice the difference between their impact.

Which code is used to clear the console?

In the above example, we have specified the Windows operating system and the command that is used to clear the console is cls. We can also use the following code in the above program: public final static void clearConsole()

How do I clear a running terminal?

Show activity on this post. Use Ctrl + K to clear the terminal.

What is the command clear?

clear is a computer operating system command which is used to bring the command line on top of the computer terminal. It is available in various Unix shells on Unix and Unix-like operating systems as well as on other systems such as KolibriOS.


3 Answers

Try this:

console.clear();

You can use this code in your scripts. Read more about console.

Note that in Google Chrome, console.clear() has no effect if the user has selected "Preserve log upon navigation" in the settings.

Update: As noticed @evolutionxbox you can use just clear() to do that. You'll get the same result.

You can also clear console in the web browsers with keyboard shortcuts: CTRL + L

Clear console in Firebug: ALT + R

like image 150
Ali Mamedov Avatar answered Oct 01 '22 02:10

Ali Mamedov


You can use either below commands

 clear()
 console.clear()
 window.clear()

OR

CTRL + L as Shortcut to clear Developer Console.

like image 39
Jenson M John Avatar answered Oct 01 '22 02:10

Jenson M John


You can use console.clear(), at least in Chrome.

like image 35
Laurens Avatar answered Oct 01 '22 02:10

Laurens