D
D
delkov2016-09-07 08:46:35
linux
delkov, 2016-09-07 08:46:35

Command completion from history in bash?

Good day, dear ones!
Interested in the following feature in bash:
Let me type

cat /etc/test
cat /etc/test2

Then I enter again
cat /e
and press the up / down arrows and I am offered commands from the history, the beginning of which coincides with the entered one, i.e.
cat /etc/test2
cat /etc/test

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2016-09-07
@delkov

unix.stackexchange.com/a/20830

A
abcd0x00, 2016-09-07
@abcd0x00

Open man bash and read the section about READLINE there (you can find it with /^READLINE in less).
Lots of Emacs combinations work there. And incremental history search via Ctrl + r is one of them.
There you can manage words (cut, paste, swap, jump across words), manage characters, manage a line, there are even macros.
Запись макроса, который вставляет символы abc, и дальнейший вызов его пять раз:

C-x (
abc
C-x )
M-5
C-x e

C - Ctrl
M - Alt
Выведет abcabcabcabcabc.

D
Dmitry Bannik, 2016-09-08
@prodimon

The question is kind of unclear.
what you ask works out of the box.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question