The Forgotten Command Line escape sequences

For as long as I can remember, I’ve used ctrl+l  to clear my bash screen, ctr+d to exit/logout of my bash session.  When editing, the escape sequenced key combinations I’ve used, some more than others, are:

ctrl+a Moves cursor to the beginning of the command line (used often for when I forget to type sudo prior to it).
ctrl+e Moves cursor to the end of the command line (often used after I used ctrl+a to add parameters.
ctrl+u After hitting up arrow and realizing I don’t want this command, I use this to clear to the beginning of the line.
ctrl+k After hitting up arrow and moving back a few spaces or words, you want to delete the line to the right (like D in vi.
ctrl+l Much quicker than typing clear.
ctrl+d Much quicker than typing exit.

And then there are some sequences that I knew it existed, but just didn’t use.  For example, ctrl-r.  This allows one to search the command history contextually.  I guess I got too used to typing history|grep -i  for what I was looking for but ctrl-r does seem much more powerful.

Since I use vi (and spacevim) for all of my editing-needs when at the command line (even though I registered my Sublime), I was thinking that some form of b and f would exist.  And they do!  But, it’s in the form of ctrl+[ b and ctrl+[ f.  Well, you can either remap them to send these escape sequences pressing ctrl-b and ctrl-f (but you’ll lose the backward / forward character key-sequenced that these normally use), OR you can enable the meta key on your terminal.

Leave a Reply