You are not logged in.
Pages: 1
In debian there is the package hstr.
❯ apt show hstr
Package: hstr
Version: 3.1+ds-1+b1
Priority: optional
Section: utils
Source: hstr (3.1+ds-1)
Maintainer: Daniel Echeverri <epsilon@debian.org>
Installed-Size: 80,9 kB
Depends: libc6 (>= 2.34), libncursesw6 (>= 6), libreadline8t64 (>= 6.0), libtinfo6 (>= 6)
Homepage: https://github.com/dvorka/hstr
Tag: uitoolkit::ncurses
Download-Size: 30,5 kB
APT-Manual-Installed: yes
APT-Sources: https://deb.debian.org/debian trixie/main amd64 Packages
Description: Suggest box like shell history completion
Command line tool that brings improved bash/zsh command completion
from the history. It aims to make completion easier and more efficient
than Ctrl-r.
.
HSTR can also manage your command history (for instance you can remove
commands that are obsolete or contain a piece of sensitive information)
or bookmark your favorite commands.Called 'hstr' in the terminal, it tells me which (historical) commands I used. If I enter 'f', I find 'fastfetch' as an example.
Unfortunately, I can't immediately call up the command I found again with Enter. So I have to copy the command and enter it again in the terminal.
Does anyone know of a workaround that would make it work anyway?(without copying first)
Last edited by unklar (Yesterday 09:48:54)
Offline
Don't know about hstr, but with fzf configured, the usual keybind is ctrl+r and it should display interactive selector, like
❯
4193 cd bin
4194 lst
4195 rm hhx
4196 uptime
4198 up
4199 cowsay woot
4200 pi
4202 reset
4205 hstr h
4206 hstr
4207 history 0 | grep '^hx '
4209 cd
> 4210 sudo apt install hstr
4212 hstr fast
4213 hstr ^fast
4214 hstr fastfetch
4216 hstr -i fastfetch
4217 man hstr
4218 hstr | fzf
4219 myip │
4147/4147 +S ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>then you select and enter or type to search for specific incantation. (I'am on zsh, but should work the same with bash irc).
Offline
Another way: create ~/.inputrc and put these lines in:
# use up & down arrows to search history
"\e[A":history-search-backward
"\e[B":history-search-forward
"\e[C": forward-char
"\e[D": backward-charStart typing some recent command in the terminal and hit the up arrow. Type more if it's not coming up. Hit Enter when you get what you want.
There are other things you can do with .inputrc. I now forget where I got it, but this is mine:
# /etc/inputrc - global inputrc for libreadline
# See 'man readline' (3readline) and `info rluserman' for more information.
# Colour in <Tab> completions
set colored-stats on
# The common prefix of all completion suggestions is shown in a different color.
set colored-completion-prefix on
# Be 8 bit clean.
set input-meta on
set output-meta on
# To allow the use of 8bit-characters like the german umlauts, uncomment
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.
# set convert-meta off
# try to enable the application keypad when it is called. Some systems
# need this to enable the arrow keys.
# set enable-keypad on
# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
# do not bell on tab-completion
# set bell-style none
# set bell-style visible
# When set to a value greater than zero, common prefixes longer than this value are replaced with an ellipsis when displaying possible completions.
set completion-prefix-display-length 4
# If set to ‘on’, completed names which are symbolic links to directories have a slash appended (subject to the value of mark-directories). The default is ‘off’.
set mark-symlinked-directories off
# If set to ‘on’, words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell.
set show-all-if-ambiguous off
# some defaults / modifications for the emacs mode
$if mode=emacs
# Case-insensitive tab completion
set completion-ignore-case On
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert
# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history
# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward
# use up & down arrows to search history
"\e[A":history-search-backward
"\e[B":history-search-forward
"\e[C": forward-char
"\e[D": backward-char
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
#"\e[1;5C": forward-word
#"\e[1;5D": backward-word
#"\e[5C": forward-word
#"\e[5D": backward-word
#"\e\e[C": forward-word
#"\e\e[D": backward-word
$if term=rxvt
"\e[8~": end-of-line
"\eOc": forward-word
"\eOd": backward-word
$endif
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line
# for freebsd console
# "\e[H": beginning-of-line
# "\e[F": end-of-line
$endifI don't use many of these, other than the up arrow which gets hit multiple times an hour, and oh yes, the Home and End keys are useful. ![]()
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
^Thank you for your answers. ![]()
@bronto, I think this is exactly what I was looking for for my purposes.
https://www.baeldung.com/linux/fzf-command
https://linux-trainings.de/p/fzf-befehl … -beispiele
Offline
Pages: 1