Skip to main content
3 of 4
edited title
muru
  • 78.1k
  • 16
  • 213
  • 319

Can I make the clear command behave like Ctrl-L in Bash?

It seems that clear and bash Ctrl-L are quite different; clear completely removes all previous terminal information (so you cannot scroll up) while Ctrl-L just scrolls the screen so that the cursor is at the top of the page so that you can still scroll up and see previous information. I much prefer the Ctrl-L system. Is there a way to override clear so that it does a Ctrl-L instead of wiping all previous terminal information? This is not a huge issue, but I'm just wondering out of curiosity if there is a way to alias clear to point at my preferred Ctrl-L functionality.

As a side note, I just noticed that PowerShell also has a binding for Ctrl-L and it performs the same way as Ctrl-L on bash, seems the designers there took a lot from bash, but that cmd.exe consoles do not have this functionality).

YorSubs
  • 661
  • 2
  • 7
  • 14