How do you clear the entire terminal in BASH, like the command prompt's cls
command?
clear
doesn't work because it doesn't actually clear anything, it just scrolls down.
cls is a clear screen command for Windows Command Prompt (MS-DOS)
When using the bash shell, you can also clear the screen by pressing Ctrl + L .
MS-DOS and Windows command line cls command The cls command allows users to clear all the contents on the screen and leave only a prompt.
As far as I know, there isn't a way to do this any better than what clear
does with bash.
I think it's a feature that could be built into the terminal you're using though. I know the Mac Terminal app has a 'Clear Scrollback' menu option (command + k) that does what you're asking for.
Why don't you try Ctrl+l (control, lowercase "L"). This works in most shells (err terminals)...
In OSX terminal -
Command ⌘+l (command, l) leads to removing last typed command from display.
Command ⌘+k (command, k) leads to removing/clearing all display buffer.
reset
(type this in terminal) leads to reset of terminal in case display becomes garbled.
not sure of equivalent in other unix flavors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With