"clear" does not clear the terminal #21053

Closed
opened 2026-01-31 07:31:48 +00:00 by claunia · 9 comments
Owner

Originally created by @Y0rg0 on GitHub (Jan 4, 2024).

Windows Terminal version

1.19.3172.0

Windows build number

10.0.19045-3803

Other Software

No response

Steps to reproduce

  1. open the Terminal
  2. type any command that produces output in the terminal - e.g. a simple "dir" or "cd C:" will do
  3. type "clear" to clear the terminal

Expected Behavior

"clear" to always clear the previous output...

Actual Behavior

cursor will be positioned at the top of the inner window, but the previous output still is visible below
(this does not happen all the time, but mostly)

Originally created by @Y0rg0 on GitHub (Jan 4, 2024). ### Windows Terminal version 1.19.3172.0 ### Windows build number 10.0.19045-3803 ### Other Software _No response_ ### Steps to reproduce 1. open the Terminal 2. type any command that produces output in the terminal - e.g. a simple "dir" or "cd C:\" will do 3. type "clear" to clear the terminal ### Expected Behavior "clear" to _always_ clear the previous output... ### Actual Behavior cursor will be positioned at the top of the inner window, but the previous output still is visible below (this does not happen all the time, but mostly)
claunia added the Needs-TriageIssue-BugResolution-ExternalNeeds-Attention labels 2026-01-31 07:31:49 +00:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 4, 2024):

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@github-actions[bot] commented on GitHub (Jan 4, 2024): Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! ### Closed similar issues: - [Ability to clear the Terminal (#7555)](https://github.com/microsoft/terminal/issues/7555), similarity score: 0.86 - [Clear command doesn't clear the screen (#4445)](https://github.com/microsoft/terminal/issues/4445), similarity score: 0.84 - [Clear-Host does not clear the entire Windows Terminal contents (#13940)](https://github.com/microsoft/terminal/issues/13940), similarity score: 0.83 - [Keyboard Shortcut to clear terminal (#9603)](https://github.com/microsoft/terminal/issues/9603), similarity score: 0.81 - [Ability to clear the terminal using keyboard shortcut (#7775)](https://github.com/microsoft/terminal/issues/7775), similarity score: 0.80 > Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Author
Owner

@zadjii-msft commented on GitHub (Jan 4, 2024):

Hmm. I can't seem to repro this. Do you have any more detailed repro steps? How are you launching the Terminal? What shell are you using (PowerShell? CMD? Bash/zsh/fish/etc)? Do you have anything in your shell settings/profile that might be at play here? Something that attempts to resize the window perhaps?

@zadjii-msft commented on GitHub (Jan 4, 2024): Hmm. I can't seem to repro this. Do you have any more detailed repro steps? How are you launching the Terminal? What shell are you using (PowerShell? CMD? Bash/zsh/fish/etc)? Do you have anything in your shell settings/profile that might be at play here? Something that attempts to resize the window perhaps?
Author
Owner

@Y0rg0 commented on GitHub (Jan 4, 2024):

This problem only occurs when the mentioned output only fills the screen partly, e.g. by just typing "cd" -- which typically only produces one or two lines of output; if I do a "dir" instead which fills the whole terminal window, "clear" always works...

btw: this is for normal CMD shell.

@Y0rg0 commented on GitHub (Jan 4, 2024): This problem only occurs when the mentioned output only fills the screen partly, e.g. by just typing "cd" -- which typically only produces one or two lines of output; if I do a "dir" instead which fills the whole terminal window, "clear" always works... btw: this is for normal CMD shell.
Author
Owner

@Y0rg0 commented on GitHub (Jan 4, 2024):

see attached screen-recording (archive contains .mp4 video recorded by OBS):

2024-01-04 16-15-41.zip

@Y0rg0 commented on GitHub (Jan 4, 2024): see attached screen-recording (archive contains .mp4 video recorded by OBS): [2024-01-04 16-15-41.zip](https://github.com/microsoft/terminal/files/13832042/2024-01-04.16-15-41.zip)
Author
Owner

@zadjii-msft commented on GitHub (Jan 4, 2024):

huh. Where did you get clear from/? That's not a built-in CMD intrinsic like cls is, and there isn't a clear.exe that ships inbox.

@zadjii-msft commented on GitHub (Jan 4, 2024): huh. Where did you get `clear` from/? That's not a built-in CMD intrinsic like `cls` is, and there isn't a `clear.exe` that ships inbox.
Author
Owner

@237dmitry commented on GitHub (Jan 4, 2024):

What is clear? What about to use cls ?

 C:\> clear
'clear' is not recognized as an internal or external command,
operable program or batch file.

 C:\> where clear.*
INFO: Could not find files for the given pattern(s).


@237dmitry commented on GitHub (Jan 4, 2024): What is `clear`? What about to use `cls` ? ``` C:\> clear 'clear' is not recognized as an internal or external command, operable program or batch file. C:\> where clear.* INFO: Could not find files for the given pattern(s). ```
Author
Owner

@Y0rg0 commented on GitHub (Jan 4, 2024):

C:\Users\xxxx>where clear
C:\Program Files\Git\usr\bin\clear.exe

excellent find - and "cls" works better -- thank you :)

@Y0rg0 commented on GitHub (Jan 4, 2024): C:\Users\xxxx>where clear C:\Program Files\Git\usr\bin\clear.exe excellent find - and "cls" works better -- thank you :)
Author
Owner

@zadjii-msft commented on GitHub (Jan 4, 2024):

Yep, that makes sense. Thanks for following up!

@zadjii-msft commented on GitHub (Jan 4, 2024): Yep, that makes sense. Thanks for following up!
Author
Owner

@Y0rg0 commented on GitHub (Jan 4, 2024):

to my defense :-)
I work in Windows and Linux, so I am used to use commands that work in both universes:
"clear" does this (normally...), but "cls" is not known in Linux...

@Y0rg0 commented on GitHub (Jan 4, 2024): to my defense :-) I work in Windows and Linux, so I am used to use commands that work in both universes: "clear" does this (normally...), but "cls" is not known in Linux...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21053