Bash on Ubuntu on Windows: Clearing all the text, ALL of it

The most reliable and portable command that I've found1 is:

printf '\033c\e[3J'

Clearly, it's too long and complex to type it every time. The solution is to define an alias, so that it can be run by using a much easier name. My suggestion is to choose cls, which is the name this command has in cmd shells on Windows.
To set cls as alias, enter this line:

alias cls="printf '\033c\e[3J'"

This will enable the alias in the current shell. If you want to always have it at your disposal every time you open a new terminal, add that line to your .bashrc file in your home directory.


1. I was previously suggesting to use clear && echo -en "\e[3J", as explained at Stack Overflow, but for some users it doesn't work, so I've updated my answer.


I don't have an answer for Windows' default Ubuntu terminal. Based on DavidPostill's link, it seems the dev team is aware of the issue so I assume it will be fixed in a future release. In the meantime, I simply switched to using MinTTY for WSL (https://github.com/mintty/wsltty). The "reset" command works perfectly in that terminal, it completely clears all the text output while leaving the window dimensions alone.