How To Clear Command Prompt
Maybe your like
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).
You can also use the Backspace key on your keyboard.

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.

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.
The Alt key is usually on the bottom of the keyboard (close to the Space bar). The F7 key is on the top row of the keyboard.
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 -cThis will clear all previous commands from the current shell section.
After executing history -c, if you press up arrow key, no previous command will be displayed. To delete a particular command from the history, enter history -d <command-line-number>
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.
- Was this page helpful?
- Yes (6)No (2)
Tag » How To Clear Command Prompt
-
How To Clear Command Prompt Screen Windows? - STechies
-
How To Clear The Windows Command Prompt Screen - Lifewire
-
[SOLVED] How To Clear Command Prompt Screen Windows 10
-
Clear Windows Command Prompt Screen Using Keyboard Shortcuts
-
How To Clear The Command Window Screen? - Techwalla
-
How To Clear The Screen Of The Command Prompt Window (CLS)
-
Different Ways To Clear Command Prompt Screen In Windows 10
-
How To Clear Screen In A Windows Command Line (MS-DOS)
-
How To Clear Command Prompt Screen On Windows 11 | CLS
-
How To Clear The Windows Command Prompt Screen - Quora
-
How To Clear The Command Prompt Screen In Windows 10 - Tab-TV
-
How To Quickly Clear The Command Prompt Screen On Windows 10 ...
-
How To Clear Screen In CMD Windows - E Learning
-
CMD: Clear Screen - Clear Command Prompt - ShellHacks