Literally the most useful keyboard shortcut I learned this year is ctrl + U

It deletes a filled password field on linux. In your browser, on the bootscreen when entering your LUKS password, your login password field, in the sudo prompt, …

It's great when you have a long password and you know you hit a typo somewhere.

Try it it's awesome. And it's the worst thing, that it doesn't work on other platforms.

@sheogorath that's amazing, I usually just mash backspace until it beeps at me

@robjloranger I know what you mean. But just pressing ctrl + U is so much more convenient. Once you get used to it, it feels super complicated to clean password fields in any other way.

@sheogorath Kids these days! We were adding ^U into our uucp login scripts in front of the password in 1980s. When using a modem without MNP error correction, it cleared out line noise and increased chances for password to become accepted. Back then, ^U was implemented by kernel, as a part of terminal line discipline. Readline came later.

@pro Grandpas and their war stories :blobfoxwinkmlem:

"We didn't have such luxury back then, everything was made of stone and wood, even computers" :blobfoxwink:

@sheogorath Great finding!

Another handy shortcut you might like is Ctrl + Y (or ^Y), which yanks the text killed by ^U. It’s useful when you enter a command, recall you had to do something else quickly and kill that command, and later continue with the initial task.


$ make install ^U $ ed grocery.txt $a carrots . $ ^Y

After the ^Y at the end, you’d end up with the command make install re-entered. It’s also handy when you know you’d run several commands that start similar but have different last argument.

@sheogorath Ctrl U does from your cursor to the line beginning, Ctrl K deletes from your cursor to the end of the line! :reisensmile:

Ctrl A - go to line beginning
Ctrl E - go to line end

And one more for shell users:
Alt # - transform current line in comment and insert it in history (then gives you a blank prompt)
Sign in to participate in the conversation
Sheogorath's Microblog

This is my personal microblog. It's filled with my fun, joy and silliness.