Your Search Bar For Shrewd Tips

How Do I Clear In Cmd?


To clear the screen in Windows Command Prompt, type cls and press Enter. The command clears the text displayed in the current Command Prompt window and gives you a fresh screen. It works in both Command Prompt opened from the Start menu and Command Prompt launched inside Windows Terminal.

Clear the Command Prompt Screen With CLS

Follow these steps to clear the screen in cmd:

  • Click inside the Command Prompt window.
  • Type cls.
  • Press Enter.

For example, if your window contains several commands and their results, entering this clears the displayed text:

C:\Users\Alex>cls

The command prompt returns at the top of the window, ready for your next command. You do not need to type a slash, add quotation marks, or use a special option. The command is not case-sensitive, so CLS, Cls, and cls all work.

What Does CLS Do?

cls is short for “clear screen.” It is a built-in Command Prompt command that clears the console display. You can use it whenever the window becomes cluttered and you want to make new output easier to read.

Clearing the screen changes what is displayed; it does not undo earlier commands or reverse changes they made to your computer. If you previously created a folder, copied a file, or ran a program, cls does not reverse that action. It simply clears the text from view.

What you can scroll back to may depend on the console app and its settings. In some environments, earlier output may remain available in the scrollback area even after cls. The command should not be treated as a way to securely erase information or remove saved logs.

Clear the Screen Before Running Another Command

You can run cls on its own, or combine it with another command. To clear the screen and then list the files and folders in the current directory, use:

cls && dir

The && operator runs the second command if the first command succeeds. You can also use a single ampersand to run commands in sequence:

cls & dir

For most everyday use, typing cls and pressing Enter is simpler. Combining commands is handy when you want to start a task with a clean display, especially when running a series of commands or checking a directory.

Use CLS in a Batch File

You can add cls to a batch file to clear the Command Prompt window when the script starts or reaches a particular point. Batch files use the .bat or .cmd file extension.

For example, a basic batch file might look like this:

@echo off
cls
echo Welcome to the script.
pause

In this example, @echo off prevents commands from being printed as the script runs, cls clears the display, and echo shows a message. The pause command keeps the window open so you can read the result.

You can also place cls later in a script to clear the screen between stages. Keep in mind that clearing the display can make it harder to review earlier progress or error messages. If you need a record of the script’s output, consider saving or logging that output rather than relying on the visible window.

Does Ctrl+L Clear the Screen in CMD?

Not reliably. Keyboard shortcuts can vary between classic Command Prompt, Windows Terminal, and other terminal apps. Some shells or terminal configurations use Ctrl+L to clear the display, but the dependable Command Prompt command is cls.

If a keyboard shortcut does not work in your window, type cls and press Enter. This method works without relying on a particular shortcut configuration.

Does CLS Delete Command History?

No. cls clears the display, not the command history. You may still be able to use the up and down arrow keys to recall commands entered earlier in the current session. Clearing the screen also does not delete files, remove data from the clipboard, or erase output saved to a log.

If you want to remove the visible commands, cls is the right command. If your goal is to clear or manage command history, that is a separate task and depends on the console and how its history is stored. Closing the window ends the current Command Prompt session, but it does not remove separate records that another program or system setting may have saved.

How to Clear CMD in Windows Terminal

Windows Terminal can host Command Prompt as well as other shells. When the active tab is running Command Prompt, enter cls at the prompt just as you would in the traditional Command Prompt window. The command clears the console display for that session.

Windows Terminal has its own settings and scrollback behavior, so the way previous output appears when you scroll may differ from the classic console. If you need to remove scrollback as well as clear the current display, check the terminal’s available actions and settings. Do not assume that cls securely erases previous output or saved records.

CMD CLS vs. Clear Commands in Other Shells

The command you use depends on which shell is open. In Command Prompt, use cls. In PowerShell, Clear-Host is the full command for clearing the display; cls is also commonly available there as an alias. In many Linux and macOS terminals, the command is clear, not cls.

If you enter clear in Command Prompt, Windows may respond that it is not recognized as an internal or external command. That does not mean the console is broken; it means the command is for a different shell. Use cls in cmd.

Troubleshooting When CLS Does Not Work

  • Check the prompt: Make sure you are typing into a Command Prompt window, not into a program that is currently running inside it.
  • Press Enter: The screen will not clear until you submit the command.
  • Check for a typo: Enter cls without extra characters or punctuation.
  • Wait for a running program to finish: If another application is using the console, it may not accept the command until control returns to the prompt.
  • Try a new Command Prompt window: Open Command Prompt from the Start menu and test cls there.

You do not need administrator access to clear the Command Prompt screen. If cls seems to do nothing, the most common cause is that the console is busy running another command or application, rather than waiting for input.

Conclusion

To clear the screen in Windows Command Prompt, type cls and press Enter. It is the simplest and most reliable way to remove displayed text and continue working in a cleaner window. You can also use it in batch files or combine it with commands such as dir. Remember that cls clears the display, not command history, files, or saved logs—and use the command that matches your shell if you are working in PowerShell or a Linux or macOS terminal.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


💡 Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments 👇

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum →