SHARE
TWEET

Interactive terminal editing commands in BASH

pm74 Jul 3rd, 2014 524 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. INTERACTIVE EDITING COMMANDS IN BASH (STANDARD TERMINAL MODE)
  2.  
  3.  
  4. Readline Bare Essentials
  5.  
  6. [...]
  7.  
  8. CTRL-_ {NOTE: on a foreign keyboard layout---e.g. German---you may need to press three keys: CTRL-SHIFT-{DASH}}
  9.  
  10.     This will undo the last thing that you did. You can undo all the way back to an empty line.
  11.  
  12. Readline Movement Commands
  13.  
  14. CTRL-A
  15.     Move to the start of the line.
  16. CTRL-E
  17.     Move to the end of the line.
  18. META-F
  19.     Move forward a word.
  20. META-B
  21.     Move backward a word.
  22. CTRL-L
  23.     Clear the screen, reprinting the current line at the top.
  24.  
  25. Note how CTRL-F will move forward a _character_, while META-F will move forward a _word_. It is a loose convention that control keystrokes operate on characters while meta keystrokes operate on words.
  26.  
  27. Readline Killing Commands
  28.  
  29. "Killing" text means to delete the text from the line, but to save it away for later use, usually by yanking (re-inserting) it back into the line. When you use a kill command, the text is saved in a kill-ring; the text that you killed on a previously typed line is available to be yanked back later, when you are typing another line.
  30.  
  31. Available commands:
  32.  
  33. CTRL-K
  34.     Kill the text from the current cursor position to the end of the line.
  35. META-D
  36.     Kill from the cursor to the end of the current word, or if between words, to the end of the next word.
  37. META-DEL
  38.     Kill from the cursor to the start of the current word, or if between words, to the start of the previous word.
  39. CTRL-W
  40.     Kill from the cursor to the previous whitespace. This is different than META-DEL because the word boundaries
  41. differ.
  42.  
  43. Yanking the text back into the line (i. e. restoring the most-recently-killed text from the kill buffer)
  44.  
  45. CTRL-Y
  46.     Yank the most recently killed text back into the buffer at the cursor.
  47. META-Y
  48.     Rotate the kill-ring, and yank the new top. This is possible if and only if the prior command was CTRL-y or META-y.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top