M
M
moreh2015-06-03 11:37:36
linux
moreh, 2015-06-03 11:37:36

How to make that in the linux console the last command is filtered by the first characters entered?

The last command when pressing the up arrow.
In my opinion, this was in the shell under the fryakha, but I don’t remember anymore :)
Is it possible to do this through bash?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
DevMan, 2015-06-03
@moreh

search by first characters is available in zsh.
for bash it is done like this:

# add to /etc/inputrc or ~/.inputrc
"\e[A":history-search-backward
"\e[B":history-search-forward

E
Eddy_Em, 2015-06-03
@Eddy_Em

You can use PgUp/PgDw instead of ctrl+R/ctrl+S. Go to /etc/inputrc and add

"\e[5~": history-search-backward # Previous
"\e[6~": history-search-forward      # Next

Then it will be possible, by typing the beginning of the command, using PgUp / PgDw to search through the history.
And in general, we read mana .

A
Adamos, 2015-06-03
@Adamos

ctrl-r?

M
moreh, 2015-06-03
@moreh

I installed zsh a long time ago, I don’t remember how there,
to clarify, it’s like in the console I enter, say, “py” and use the up arrow to go through all the commands starting with py ...
ctr + r is not that :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question