Last Updated: 29 Oct 2023

   |   

Author: 114.119.147.6

GNU Readline: Useful Command Line Navigation Tools

Most varieties of Unix/Linux use GNU Readline which lets you edit commands on the command line, gives you a command-line history, handles tab-completion, and the like.

Many of the basic commands are pretty obvious: you use the left/right arrow keys to move your cursor. Up/down arrow keys scroll through the saved command history.

Some, however, extremely useful, but are a bit more esoteric. Remmeber that C means the 'Control' key, and M means the 'Meta' key, which is usually Option (OS X) or ALT (Windows).

C-a - move to the beginning of the line. C-e - move to the end of the line M-b - move back one word (incidentally, C-f is forward a character, but you have arrow keys for that) M-f - move forward one work C-] + character - move forward to the next instance of character M-C-] + character - same, but move backwards

Finally, there are some really esoteric commands. Generally, I don't find it that worthwhile to learn these, but Peter Krumins has put together a GNU Readline cheat sheet with all the gory details. He's also got a good article that covers a few of the more advanced concepts.

Discussion

Enter your comment. Wiki syntax is allowed: