How do I go back to the bottom of history after pressing up in Bash?

in flag

If I scroll way up or use Ctrlr search and go way up in the history, how to get back down to the clear line? I know I can clear with Ctrle, Crtlu, but that modifies them. Is there an official way beside Ctrlc to reset the shell?

us flag

Two "official" options (from 8.4 Bindable Readline Commands in the Bash manual):

abort (C-g)
Abort the current editing command and ring the terminal’s bell (subject to the setting of bell-style).
end-of-history (M->)
Move to the end of the input history, i.e., the line currently being entered.

M-> can be entered by pressing Alt>, or Esc followed by >.


  • abort is to be used while in the history search mode.
  • end-of-history, on the other hand, should be used after selecting a command from the history search mode (by, e.g, pressing Esc or an arrow key).
alchemy avatar
in flag
Thanks a bunch. Works a treat! Well the move to end-of-history does. The C-g doesnt but that could be because of an overriding key shortcut in Kubuntu. Konsole has a few of those (C-k). Another handy key combo is C-d to 'exit', often just exits a process and leaves you in the shell, and C-\ will kill many rogue processes and 'dump' (to somewhere). Thanks for the reference doc.
muru avatar
us flag
@alchemy Ctrl-D typically sends an EOF indicator, and Ctrl-\ sends sigquit (those are typically managed by [the line discipline]( You can see these settings using `stty -a` (e.g.,
alchemy avatar
in flag
Ah, you're right about C-d being EOF, which is basically what happens when you press enter in "icanon" mode (if I understand Modern terminals have their own more complex "line editors" and so C-d is a great key to replace. I use it for "intr" interupt so that I can have C-c as copy and C-x as paste. Interesting though that "icanon" mode looks like C-u used to clear the entire line instead of using C-e,C-u combo.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.