< Previous | Contents | Next >
Cutting And Pasting (Killing And Yanking) Text
The Readline documentation uses the terms killing and yanking to refer to what we would commonly call cutting and pasting. Items that are cut are stored in a buffer called the kill- ring.
Table 8-3: Cut And Paste Commands
Key Action
Key Action
Ctrl-k Kill text from the cursor location to the end of line.
Ctrl-u Kill text from the cursor location to the beginning of the line.
Alt-d Kill text from the cursor location to the end of the current word.
Alt- Backspace
Kill text from the cursor location to the beginning of the current word. If the cursor is at the beginning of a word, kill the previous word.
Ctrl-y Yank text from the kill-ring and insert it at the cursor location.
The Meta Key
If you venture into the Readline documentation, which can be found in the READLINE section of the bash man page, you will encounter the term “meta key.” On modern keyboards this maps to the Alt key but it wasn't always so.
Back in the dim times (before PCs but after Unix) not everybody had their own computer. What they might have had was a device called a terminal. A terminal was a communication device that featured a text display screen and a keyboard and just enough electronics inside to display text characters and move the cursor around. It was attached (usually by serial cable) to a larger computer or the com- munication network of a larger computer. There were many different brands of terminals and they all had different keyboards and display feature sets. Since they all tended to at least understand ASCII, software developers wanting portable ap- plications wrote to the lowest common denominator. Unix systems have a very elaborate way of dealing with terminals and their different display features. Since the developers of Readline could not be sure of the presence of a dedicated extra control key, they invented one and called it “meta.” While the Alt key serves as the meta key on modern keyboards, you can also press and release the Esc key to get the same effect as holding down the Alt key if you're still using a terminal (which you can still do in Linux!).