The clear
command in Linux is used to clear the terminal’s screen.
You can also use the clear
command in a Windows PowerShell where it is an alias of the Clear-Host
command, that does pretty match the same – removes all text from the current display, including commands and output that might have accumulated.
But if you try to execute the clear
command in a Windows command-line prompt (CMD), expecting it to clear the screen, you will get an error as follows:
‘clear’ is not recognized as an internal or external command,
operable program or batch file.
Below you will find how to clear the command prompt in Windows.
Clear Command Prompt
To clear the screen in the Windows command-line prompt (CMD), use the cls
command:
C:\> cls
clear local screen : -)
afterthought, in a Linux terminal i invariably always use ^l (Ctrl + lowercase L) which is more efficient than typing clear