Questions tagged [readline]

GNU Readline is a library that provides command-line editing and history searching capabilities for Bash and other interactive command-line programs. Use this tag for questions relating to the use of Readline functionality in Bash and other software.

should be used for questions pertaining to the configuration and use of GNU Readline in Bash and other command-line software as Python or MySQL (see , and ). Use for questions about Readline's configuration file and its syntax.

GNU Readline is a library for command line editing. The most prominent program that uses it is Bash, and Bash and Readline have the same maintainer. Many other programs with a command line interface use it, for example the Python toplevel. Readline's capabilities include basic editing facilities, command history, (internal) copy-paste and completion. Readline has different modes such as Emacs mode and vi mode which provides Emacs/vi-like bindings for line-editing.

Readline's configuration file is ~/.inputrc, see for questions and answers specific to its syntax.

The rlwrap utility provides Readline's capabilities to programs that just read from standard input.

Further reading

External links

304 questions
976
votes
3 answers

How to unfreeze after accidentally pressing Ctrl-S in a terminal?

It's a situation that has happened quite often to me: after I press (with a different intention) Ctrl-S in a terminal, the interaction (input or output) with it is frozen. It's probably a kind of "scroll lock" or whatever. How do I unfreeze the…
75
votes
2 answers

Is there any way to enable Ctrl+L to clear screen when 'set -o vi' is set?

When you press Ctrl + L in bash default mode the screen is cleared. But when I run set -o vi and press Ctrl + L the keystroke is printed ( ^L ). Is there any way to keep this behavior?
70
votes
5 answers

Where do I find a list of terminal key codes to remap shortcuts in bash?

For example: "\e[1;5C" "\e[Z" "\e-1\C-i" I only know bits and pieces, like \e stands for escape and C- for Ctrl , but what are these numbers ( 1 ) and letters ( Z )? What are the ; , [ and - signs for? Is there only trial and error, or is there a…
bug
  • 2,728
58
votes
2 answers

How to remove last part of a path in bash?

Possible Duplicate: How to delete part of a path in an interactive shell? Is there a short-cut in bash that lets you delete the last part of a path? Example: /usr/local/bin should become /usr/local/ (or /usr/local ) I know of Ctrl + w but it deletes…
Siggy
  • 589
35
votes
3 answers

Execute a readline function without keybinding?

I was just reading the readline man-page and discovered a bunch of great commands I didn't know about. However, several don't have default key bindings. Is there a way to execute the unbound commands from the shell? I'm not asking how to bind the…
erikcw
  • 451
34
votes
9 answers

How to repeat currently typed in parameter on Bash console?

I was just typing something along the lines of: mv foo/bar/poit/zoid/narf.txt Suddenly I realized, damn, I have to type large parts of that parameter again: mv foo/bar/poit/zoid/narf.txt foo/bar/poit/zoid/troz.txt Even with tab completion, that's…
k0pernikus
  • 16,769
28
votes
3 answers

Configure up-arrow to browse through commands with same initial characters rather than all previous commands

On the bash command-line, ↑ gives me the previous command. On the command-lines in ipython or matlab , when I type a few characters, ↑ gives me the previously entered command starting with those characters . How can I enable exactly this behaviour…
gerrit
  • 3,637
26
votes
5 answers

Typing a bash command, I'm at its third line. But how do I return to its beginning to edit something I've missed?

I'm typing that command and my cursor is at the end of "supprimer des warnings" $ git commit -m "Nettoyage : > - Suppression de sources ou projets inutiles > - Corrections mineures sur les sources pour supprimer des warnings" It's the time I notice…
24
votes
3 answers

Ctrl-a does not take me to the beginning of the prompt while I am working within a GNU screen

To navigate to the starting and end of a command, I usually use Ctrl a and Ctrl e . However, when I work within a GNU screen, those keybinding do not work becuase perhaps they are being used by the GNU screen. Is there another way to move to the…
doon
  • 773
24
votes
5 answers

How do I switch to vi editing mode in readline?

I want to switch to vi editing mode in a readline environment. But I don't want to use 'set -o vi'. I want to temporarily switch using a keyboard shortcut. The man page says I can do this with M-C-j . But that doesn't work for me. I'm using Ubuntu…
23
votes
2 answers

Alt-Left to skip words does not work in terminal emulators

On a Debian Wheezy machine at previous job, I got used to Alt+Left and Alt+Right to skip between words on active command-line (in bash). However, since at home I have upgraded to Jessie (Debian 8.0, testing branch) this does not work anymore:…
Alois Mahdal
  • 4,608
22
votes
4 answers

The easiest way to clear scrollback buffer of terminal + some deeper explanation?

Why bother? Clearing scrollback buffer is handy in many ways, for example, when I wish to run some command with long output, and want to quickly scroll to start of this output. When scrollback buffer is cleared, I can just scroll to top, and will be…
20
votes
3 answers

How to undo changes in the commands-history?

In UNIX systems you can press top and bottom arrows to navigate through the previous commands. This is extremely handy. Sometimes, I go up and find a command that I want to use again, but with some variations. If I do such changes, then I don't have…
fedorqui
  • 8,269
19
votes
1 answer

What is the general format of keyname for key bindings in "inputrc" file?

I understand that the format for key bindings in inputrc file is: keyname: function-name or macro For keyname, I saw things like: "\e[B" "\e[1~" "\e[5D" "\M-l" "\C-[OD" "\e\e[D" What is the meaning of these keynames, and what is the general format…
18
votes
2 answers

Setting readline variables in the shell

I read in the man page, that you set readline parameters on an off or to a value by using set var value Is this the same as the set builtin, and how do you set the variables once inputrc has already been read and the shell is running?
rubixibuc
  • 1,797
  • 3
  • 19
  • 27
1
2 3
…
20 21