I use bash in Windows, both in Cygwin and in Git Bash (part of Git for Windows). In bash unlike in the Windows
cmd.exe Esc does not clear the line, only Ctrl + U. How can I make clear the line also?
I don't have a Cygwin or Git for Windows install handy to test this, but here's the Unix answer:
Create a file in your (cygwin) home directory named ".inputrc", and add this line to it:
On my favorite Unix variant, Control-u is mapped to unix-line-discard, which deletes everything before the cursor. If you want it to delete the whole input line, including anything that may be to the right of the cursor, use "kill-whole-line" instead of "unix-line-discard".
Note that your bash line editing mode might eat the Escape. Bash on my system defaults to vi-style line editing mode (
Note also that the .inputrc file is read when the shell starts, so after editing your ~/.inputrc, close your shell and open a new one to see if the changes worked.