N
N
nihi1ist2021-12-02 07:22:13
linux
nihi1ist, 2021-12-02 07:22:13

How to set up work with command history in Linux?

The command line has the ability to work with the history of not only commands, but also arguments. For example, if you type a command and press the up button, you can view the history for that particular command.

Tell me, what package should be installed in order for the history to work in this format?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergio, 2021-12-02
@nihi1ist

I have this set up in ~/.bashrc:

# History search with Up/Down keys.
if ; then
    bind '"\eOA": history-search-backward'
    bind '"\e[A": history-search-backward'
    bind '"\eOB": history-search-forward'
    bind '"\e[B": history-search-forward'
fi

H
hint000, 2021-12-02
@hint000

Press Ctrl-R, start typing the command, you will see the option from the history. You can continue typing and the suggested options will change if the characters you type do not match the previously suggested option. And you can at any time press Ctrl-R a few more times and immediately select from other historical options. To return to the missed option - Ctrl-Shift-R.

R
Rag'n' Code Man, 2021-12-04
@iDmitriyWinX

What you are talking about is called ZSH:)
Enjoy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question