Readline ######## :date: 2014-06-21 04:01 :author: tyrel :category: Linux :slug: readline :status: published A lot of times when I stop at someone’s computer and help them in the terminal, I use a Readline command and people say “How the heck did you do that?” Let me first backup and explain what Readline is. From the GNU Readline Documentation – “The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in.” By default, Readline is set up in Emacs mode, no you don’t have to have an extra four fingers to use Readline, most of the commands are simple. Here are a couple of the commands I use daily: Movement ~~~~~~~~ - To move to the beginning of a line, you press **^a** :sup:` ` `note: 1 <#sup1>`__ - To move to the end of a line you press **^e** Killing and Yanking ~~~~~~~~~~~~~~~~~~~ - To cut the rest of the line from where your cursor is, to the end, you press **^k** - To delete one word you press **^w** - To paste either of the two previous back you can press **^y** Miscellaneous ~~~~~~~~~~~~~ - To clear the screen and get to a fresh start, you can press **^l** - To end your session you can send a **^d** (This will send an end of file character) - To search for a command you typed recently, press **^r** and start typing, it will search backwards. **^r** again will search for an earlier match. - The inverse of **^r ** is **^s**, they function the same. Finally, don’t forget about **^c**. While not specifically Readline, it’s very useful because it sends the SIGINT signal to the program, which if just on the command line, will not execute the line you have type, and give you a new line with nothing on it. A nice clean start. To find out a lot more, read the documentation at `the Readline Commands Docs `__ I even learned some things while writing this up, apparently pressing **^x $** will list off all the possible usernames. Good to know, and good to always keep learning. *1* `#sup1-back <#sup1-back>`__ *Also, if you are unaware, the convention I use is ^ to represent control, the documentation on Readline uses C- representing the same thing.*