A great article which touches on the basics of the GNU Readline library (which almost all modern shells and REPLs use), its long history and its relationship with #Emacs (the source of its default keybindings) https://twobithistory.org/2019/08/22/readline.html