I know this was already answered, but the answer doesn't explain what's going on.
Characters like Ctrl+L are handled by the application. In the case of entering input into the shell, like
bash, it clears the screen. Some applications, like
emacs, use it to redraw the screen and/or recenter the cursor.
Characters like Ctrl+U at a password prompt are handled by the TTY line discipline. They'll work any time the input terminal is in the "canonical" line-editing mode, which is what mode your programs are in while you're entering a password. In this mode, it's the Linux kernel itself that is interpreting these characters. You can see what functions are assigned to which keys in the output of
speed 38400 baud; rows 45; columns 128; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S;
susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke
Here, you can see that Ctrl+U is tied to
kill, which (according to the stty man page) will "erase the current line". You could also use
stty to change this mapping:
stty kill ^E # make ctrl-e erase the line
This page has a lot of great information about the TTY layer if you're interested.
If things weren't confusing enough: when at the prompt of an interactive
bash, you're actually not in the "canonical" line-editing mode. Instead,
bash is receiving each character directly as you type it, and interpreting the control sequences itself, through the readline library. This library will honor the mappings you've set on your terminal device, though, so you can still use
stty to change them. Or, you can customize them independently inside
bash and other readline-based programs by setting the
unix-line-discard property inside your
~/.inputrc file. See the bash man page for more info.
When you run a program,
bash re-enables canonical line editing mode (
stty icanon) if it was enabled before, and then disables it again when the program finishes (