While working on the command line interface we often need to clear the screen once the screen gets filled with command outputs.
For clearing the screen in the Windows command line interface, we need to use different commands on cmd and PowerShell.
In this article, I will discuss how to clear the Windows command prompt or PowerShell screen.
How to clear cmd screen in Windows OS
The cmd is the default command interpreter in Windows, OS/2, and many other operating systems. On Windows, various program scripts are executed through it.
Now use the following command to clear the command prompt screen in Windows –
cls
You can see the usage of this command in the given image.
Once you type the cls and hit enter the text displayed above will get erased.
Note: – The
clear
command will not work in cmd
How to clear PowerShell screen in Windows
PowerShell is an automation and configuration management tool that is used mostly by system administrators. The commands used on PowerShell are called cmdlets.
Now if you are using Windows PowerShell then you can use the following commands for clearing your screen –
clear
OR
cls
Both commands will work perfectly.
You can see the usage of the clear
command in the given image.
Once you type and press the above command all the text displayed on the PowerShell screen will get cleared.
If you want to know more about PowerShell and its commands then you can view its official documentation.