Clear the screen with the cls command
Type cls at the command prompt and press Enter. The window will blank out, and your cursor will move to the top left. This removes all the text that was previously displayed, giving you a fresh workspace to see new output clearly.
The cls command does not delete any files, change any settings, or affect anything on your computer — it only erases what you see on screen. Everything you typed before remains in your command history, and you can scroll up in most terminal windows to see it again. The command works when ready and is safe to use at any time.
Key Takeaways
- Type cls and press Enter to clear the Command Prompt window on Windows.
- On Mac or Linux, use clear instead of cls to achieve the same result.
- Clearing the screen does not delete files, undo commands, or affect your system — it only removes the visible text.
- You can scroll up in most terminal windows to see your previous commands even after clearing the screen.
- Keyboard shortcuts like Ctrl + L on Windows or Command + K on Mac clear the screen faster than typing the command.
Why you might want to clear the screen
A long list of commands and output can make it hard to find what you are looking for. Clearing the screen removes clutter and helps you focus on new commands you are about to run or results you need to read carefully.
Some people clear the screen between tasks to keep their workspace organized, or before running a series of commands they want to watch closely. It is purely a visual preference — the computer does not care whether the screen is full or empty. If you are troubleshooting a problem or following a set of instructions, a clean screen can help you avoid mistakes.
The difference between cls and clear
Windows Command Prompt uses cls. Mac Terminal and Linux terminals use clear. If you type the wrong one, you will get an error message saying the command is not recognized, but nothing will break on your system.
PowerShell, which is a more advanced command tool on Windows, accepts both clear and cls. If you are not sure which terminal you are using, try cls first — if it does not work, try clear. Most modern terminals are flexible enough to accept either command without complaint.
Keyboard shortcuts that do the same thing
In Windows Command Prompt, you can press Ctrl + L to clear the screen without typing the cls command. This keyboard shortcut works the same way as typing cls and pressing Enter, and it is faster if you clear the screen frequently during your work.
On Mac Terminal, Command + K clears the screen. On Linux, the keyboard shortcut varies by terminal type, but Ctrl + L often works in most distributions. These shortcuts are worth learning if you find yourself clearing the screen multiple times in a single session.
What happens to your command history after clearing
Clearing the screen does not erase your command history. In Command Prompt, you can press the Up arrow key to cycle through commands you typed before, even after you have cleared the screen. The history stays in memory until you close the window entirely.
If you close the Command Prompt window, the history is lost. If you want to save a record of commands you ran, copy and paste them into a text file before closing the window, or use the command doskey /history to print your entire session to the screen before clearing it. This is useful if you need to document what you did or repeat the same steps later.
Clearing the screen versus closing and reopening
Clearing the screen is faster than closing the window and opening a new one, but they are not quite the same thing. When you clear the screen, you stay in the same folder and keep your command history available. When you close and reopen, you start fresh in your default folder with no history of previous commands.
If you have navigated deep into a folder structure and want to stay there, clearing the screen is the right choice. If you want to start completely over and reset your location, closing and reopening is clearer. Most of the time, clearing the screen is what you want because it saves you from having to navigate back to where you were working.
Frequently Asked Questions
Does cls delete anything on my computer?
No. The cls command only removes text from your screen. It does not delete files, folders, or any data. Everything on your hard drive remains unchanged, and no files are affected in any way.
Can I undo a cls command?
You cannot undo it in the traditional sense, but you can scroll up in the Command Prompt window to see the text that was cleared. If you close the window, that text is gone from view permanently, though nothing on your computer was actually deleted.
What if cls does not work?
You are probably using Mac or Linux, where the command is clear instead. If you are on Windows and cls does not work, try typing it in all lowercase or check that you pressed Enter after typing it. You can also try the keyboard shortcut Ctrl + L instead.
Is there a way to clear the screen and the history at the same time?
Not with a single built-in command in standard Command Prompt. You can close the window to erase the history, or you can clear the screen and accept that your history remains. PowerShell and other advanced terminals may have additional options for this.
Will clearing the screen speed up my computer?
No. Clearing the screen is purely visual and does not affect your computer's performance. It does not free up memory, close programs, or change anything about how your system runs.