Are you new to using Command Prompt and want to learn how to clear it?
Option 1: Clear Command Prompt in Windows
This section is divided into 2 sub-sections. The first teaches you how to clear a Windows CMD command or screen. The second covers steps to clear Windows Command Prompt command history – delete all previous commands in the current section.
Method 1: Clear a Windows Command or CMD Screen
- If you enter a command you do not intend to in a Command Prompt, to clear the command from the CMD screen, press the Esc key on your keyboard.
In this example, I entered the command cd \, to clear it from command prompt, I will press the Esc key on my keyboard – see the location of Esc key in the second image below (last key on the top left).


The screen now clear of the command!

- However, if you have been running a lot of commands on the current CMD section and want to clear everything off the screen, type cls and press enter.
cls

The cls command clears everything from the Command Prompt screen and gives you a clean screen.

Method 2: Clear Command Prompt History on Windows
As you run commands in CMD, the shell keeps a history of all the commands you have executed in the current section. This makes it easy to call previous commands – using the up arrow key.
To clear command prompt commands from the current section, press Alt and F7 keys on your keyboard simultaneously. Before you press Alt+F7, ensure that Cmd is open and that you clicked your mouse on it.

Option 2: Clear Command Prompt in Linux
This section teaches you how to clear a command you typed but do not intend to execute. You also learn how to clear the entire Linux command shell of everything on the screen – including previous commands and command results. The section also covers steps to clear Linux command shell history.
Method 1: Clear a Linux Command or Shell Screen
- If you enter a command you do not intend to in a Linux shell, to clear the command from the shell’s screen, press the Backspace key several times until the command is cleared from the screen.
In this example, I entered the command vi, to clear it, I will press Backspace key on my keyboard several times – see the location of Backspace key in the second image below (second row, top left – beneath the Delete key).


- However, if you have been running a lot of commands on the current Linux shell and want to clear everything off the screen, type clear and press enter.

Everything on the shell’s screen is gone!

Method 2: Clear a Linux Shell Command History
As you run commands in Linux shell, the shell keeps a history of all the commands you have executed in the current section. This makes it easy to call previous commands – using the up arrow key.
However, to clear all previous commands from the current section, enter history -c and press enter
history -c
This will clear all previous commands from the current shell section.

Conclusion
You can use the methods described in this itechguide to clear command prompt in both Linux and Windows!
I hope you found this guide helpful. If you found this guide helpful, click on “Yes” beside the “Was this page helpful” question below.
You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.
Finally, for more Windows 10 Itechguides, visit our Windows 10 How-To page.



