[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: spurious CR/LF on tty (was: how to remove GUI)



On Sun, Sep 13, 2020 at 09:14:54PM -0500, David Wright wrote:
> On Sat 12 Sep 2020 at 21:45:34 (+1000), David wrote:
> > And regarding "just hit the enter key ... and all is fine", this
> > behaviour does not just occur at a login prompt. If you login quickly
> > as root to a minimal install as I often do, this behaviour occurs
> > during root console use, and if one is half-way through typing a
> > command which suddenly disappears from view, pressing enter could be a
> > recipe for disaster.
> > 
> > (eg dd before I have added the count= parameter).
> > 
> > So my habit when it occurs has become to: ctrl-u, enter, ctrl-y.
> 
> I use a different technique when I type commands that I consider
> "dangerous" (and dd is always that):
> 
> I type the command starting with # and, when I've finished,
> double-check it. Then I press <Return>, recall it with ↑, and
> press <Home>, <Space>, <Delete>, <Return> to execute it, which
> also avoids the unprotected line ending up in the history stack.

It's the same general kind of problem that you can face during terminal
usage in many situations.  Something unexpectedly scribbles on your
terminal while you're typing, whether it's modem line noise, or the
kernel warning all users of an imminent reboot, or a background job
you forgot you had running, or whatever.

There are many ways to work around it.  My preferred way is to clear
the screen with Ctrl-L (ESC Ctrl-L for me, because I use bash in vi
mode).  That will redraw the shell prompt and the partially typed
command after clearing the screen, and allow you to continue typing.


Reply to: