Tag Info

Hot answers tagged

191

Ctrl-Q To disable this altogether, stick stty -ixon in a startup script. To allow any key to get things flowing again, use stty ixany. ps: It's neither the terminal nor the shell that does this, but the OS's terminal driver.


117

Ctrl-Q is indeed the answer. I thought I'd toss in a little history of this that is too long to fit in the margins of ak2's correct answer. Back in the dark ages, a terminal was a large piece of equipment that connected to a remote device (originally another terminal because teletypes were so much easier to learn to operate than a telegraph key) over a long ...


19

Those are sequences of characters sent by your terminal when you press a given key. Nothing to do with bash or readline per se, but you'll want to know what sequence of characters a given key or key combination sends if you want to configure readline to do something upon a given key press. When you press the A key, generally terminals send the a (0x61) ...


16

Ctrl+L is also bound in vi command mode but not in insert mode. There's no default binding for clear-screen in insert mode. Readline bindings should be specified in ~/.inputrc, like so: set editing-mode vi $if mode=vi set keymap vi-command # these are for vi-command mode Control-l: clear-screen set keymap vi-insert # these are for vi-insert mode ...


11

To do literally what you're asking, put the following line in your ~/.inputrc: "\e\e[A": "cd ..\n" Here \e\e[A is byte sequence that your terminal sends when you press Alt+Up (\e is parsed as the escape character), some terminals might send \e[1;3A~ or some other sequence instead. To find out what sequence your terminal sends, run cat and press the key ...


11

Ctrl-A followed by the letter 'a' will send the Ctrl-A sequence to the shell. Or you could map the screen command key to something other than Ctrl-A


10

The readline commands that you are looking for are the history-search-* commands: history-search-forward Search forward through the history for the string of characters between the start of the current line and the current cursor position (the point). This is a non-incremental search. history-search-backward Search backward through the history for the ...


10

You probably had a local ~/.inputrc or global /etc/inputrc file defined that was lost on the upgrade. An easy fix is to create an ~/.inputrc file with the following lines: ## enable Alt-arrows "\e[1;3D": backward-word ### Alt left "\e[1;3C": forward-word ### Alt right Those will work with xterm and terminator and gnome-terminal but might need to be ...


9

In a path, it's quite easy, dirname takes off the last component of the path. And since it's a program (as opposed to a builtin) it's completely portable between shells. $ dirname /usr/local/bin /usr/local It appears you mean while editing an active line at the prompt. In that case Nikhil's comment of esc backspace (consecutively, not both at the ...


9

You can thank someone named Lino Miguel Martins Tinoco from 2004 for this one. The GNU Readline documentation for .inputrc does not allow in-line comments. Both it and the GNU Bourne Again shell manual say: Lines beginning with a `#' are comments. The line set output-meta on # Enable Meta output with eighth bit set is not a line beginning with #. ...


8

You need to remove whitespace characters from the $IFS parameter for read to stop skipping leading and trailing ones (with -n1, the whitespace character if any would be both leading and trailing, so skipped): while IFS= read -rn1 a; do printf %s "$a"; done But even then bash's read will skip newline characters, which you can work around with: while IFS= ...


8

/etc/inputrc is the system-wide configuration file for GNU readline, a library implementing a line editor used by many applications like gdb, python, GNU bc... You can find documentation about it in the readline(3) man page or the official GNU readline documentation online. readline is being maintained by the same person (Chet Ramey) as bash. bash and ...


7

This is actually your terminal doing something weird, not Vim. Terminals have two sets of control sequences associated with cursor keys, for historical reasons: one for full-screen applications, often called “application cursor keys mode”, and one for read-eval-print applications (e.g. shells). In the old days, read-eval-print applications didn't have any ...


7

Readline doesn't know anything about a modifier called Shift, and quietly ignores unknown modifier names. Try wibble-TAB. To bind an action to Shift+Tab, you need to find out what escape sequence your terminal sends. In bash, run cat and type Ctrl+V then Shift+Tab. This will insert the escape sequence literally. It's likely that the first character will be ...


7

Assuming, you are using emacs bindings, you can type Alt+Backspace to delete the previous word.


7

This line is your problem /# do not bell on tab-completion If I add that line to my working config, slash stops working. The only clue that I can find about this is in the readline man page: Blank lines are ignored. Lines beginning with a # are comments. Lines beginning with a $ indicate conditional constructs. Other lines denote key ...


7

As in your example, you can use next construction: mv foo/bar/poit/zoid/{narf.txt,troz.txt} or even (as suggested Ansgar Esztermann): mv foo/bar/poit/zoid/{narf,troz}.txt instead ot typing/copypasting long address twice.


7

You can use rlwrap for this, if you don't mind installing software. You'll probably want to keep a separate history file that only maintains history for the particular prompt in your script (ie. avoid mixing with the user's shell command history). Here's an example that might work for you: #!/bin/sh # Save in rlwrap_example.sh ...


7

It goes into a kill-ring, just like in Emacs. From the GNU Readline docuementation: When you use a kill command, the text is saved in a kill-ring. Any number of consecutive kills save all of the killed text together, so that when you yank it back, you get it all. The kill ring is not line specific; the text that you killed on a previously typed ...


7

Bash has readline commands that aren't bound by default. You can find them at reference: http://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html#Bindable-Readline-Commands Command you are looking for is called "shell-backward-kill-word". You have to select shortcut first. Let's use Crtl+p, since it's "previous command" - same as up ...


6

Not all bash line editing is controlled from ~/.inputrc; much of it is configured via the bind builtin. In this case, you want something like bind -x '"\C-gu":uptime' in your ~/.bashrc.


6

Use the Dotdeb Debian stable packages. Although the documentation does not note this, the stable packages currently work fine with Wheezy/testing. After following the instructions, do: apt-get install php5-cli as root.


6

I believe what you are looking for is the bind command itself. According to man builtin information running bind <readline-command> allows you to run one-offs, however, I couldn't get it to work like the manual says it should...it kept making keys not work for me; your mileage may vary. I did find the following commands which may be of use to you. ...


6

Add the following to your .inputrc in ~/, to do what you suggested: "\e[B": history-search-forward "\e[A": history-search-backward Perhaps you might also want to add the following to your .bash_profile : export INPUTRC=~/.inputrc


5

For hysterical historical reasons. Hardware manufacturers didn't always standardize on common single control sequence for the same key, and neither did software writers when glass terminals were replaced by terminal emulators. You can find out what control sequence a key generates in a particular terminal by typing Ctrl+V then the key (in most shells, or in ...


5

Keybinding can be done using one of the following forms: keyname: command_name "keystroke_sequence": command_name In first form you can spell out the name for a single key. For example, CONTROL-U would be written as control-u. This is useful for binding commands to single keys. In the second form, you specify a string that describes a sequence of keys ...


5

readline (which bash uses for its line editor) doesn't have that possibility. zsh does it by default though. By default, it highlights the searched text with underlining, but you can change that. For instance with: zle_highlight=(isearch:standout) Or: zle_highlight=(isearch:fg=red) (zle is zsh's line editor, like readline is bash's).


4

The set command in the readline manual is the one in readline's configuration file, ~/.inputrc. Although bash is the most famous user of the readline library, the library is generic and can be used by other programs; the syntax of .inputrc is unrelated to bash. You can make bash execute readline commands through the bind builtin: bind "set var value" ...


4

According to the freetalk documentation, it uses GNU Readline for its line editing features. According to the GNU Readline documentation: In order to switch interactively between emacs and vi editing modes, use the command M-C-j (bound to emacs-editing-mode when in vi mode and to vi-editing-mode in emacs mode). The Readline default is emacs ...


4

As an addition to the answer by Gilles who suggest recompiling the complete PHP package you can also wait for PHP 5.4. In 5.4 I restructured the readline functionality that all required parts are in the readline module, so you can build that stand alone. $ wget ...php-5.4.0.tar.bz2 $ tar xjf php-5.4.0.tar.bz2 $ cd php-5.4.0/ext/readline $ phpize && ...



Only top voted, non community-wiki answers of a minimum length are eligible