4 ms·
^Y will paste the cleared buffer back again
by harry8 10y ago
^Y will paste the cleared buffer back again
- SilasX 10y agoSo ^U will let a partial password linger in memory longer than it needs to if you use it as suggested by the GP?
- yebyen 10y agoNo, I don't think so. Not unless you are accustomed to typing your password directly into the terminal prompt. Kill buffers don't pass from one application to another and they don't all behave the same in every context, either. (For example, if I type some stuff and then ^U to kill the password buffer at an SSH password prompt, typing ^Y after that seems to put the whole process in the background. Not sure what that's intended to do, but subsequent ^Y presses don't retrieve the password into the shell prompt...)
- JdeBP 10y agoIn canonical mode, EM is the usual "delayed suspend" special character.
- klodolph 10y agoTo elaborate on yebyen's answer: these shortcuts can be handled in different layers of your stack. By default, ^U will be handled by your terminal emulator, and it will only delete the buffer, it won't remember what you've deleted. However, programs can ask the terminal emulator to pass ^U through to them so they can handle it themselves. This happens if you use libeditline (or libreadline), and these libraries implement a per-application buffer. You can test this yourself. Type some text, then ^U, then ^Y. This works because your shell uses libreadline or libeditline. Try this again in a "dumb" program like cat, or a shell without line editing like /bin/dash. ^U works, but ^Y does nothing (well, it lets you type ^Y in as much as you want).
- JdeBP 10y agoActually, NAK in canonical mode is handled by the line discipline in the pseudo terminal device rather than by the emulator.
- breadbox 10y agoActually, this is a feature of libreadline (in its default configuration). ^Y mimics the yank command from emacs. At an actual terminal input (like you can get by running `cat` with no arguments), ^Y will just echo back a literal ^Y (assuming it too is in its default configuration).