Skip to content
Search

GNU Readline

lastmod 2024-10-07created 2024-10-071 edits

GNU readline is a library that handles line editing and input history in command-line interfaces. It is part of the GNU Project.

GNU readline supports features such as input autocompletion, cursor movement, cut, copy, and paste, and is used in command-line interactive software such as Bash.

bind

The bind command is used to manage key bindings and settings in programs that use the GNU Readline library (mainly the Bash shell). With the bind command, you can view or change Readline settings in the current session.

Show all current key bindings

bind -P

Check a specific key binding

You can check the key bindings for a specific command.

bind -q <명령어>

For example, to check which keys are assigned to the beginning-of-line command:

bind -q beginning-of-line

Add a new key binding

You can add new key bindings or change existing ones.

bind '"\C-t": "transpose-chars"'

Apply a .inputrc file

Use this when you want modified .inputrc settings to take effect in the current session right away.

bind -f ~/.inputrc

Custom commands

You can also map custom commands to specific key presses. For example, you can make Ctrl + x output "Hello World!".

bind '"\C-x": "Hello World\C-m"'

With this, pressing Ctrl + x types "Hello World" into the shell and executes it (\C-m means Enter).

Setting variables

You can also set variables used by Readline.

bind 'set bell-style none'

See also

Favorite site

author Zer0 sitemap