It's hacker time (thelemmy.club)
submitted 3 months ago* (last edited 3 months ago) by to c/linuxmemes@lemmy.world
 

backup config files

you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 3 months ago* (last edited 3 months ago)

history | grep 'keyword'

If it's bash, it's using readline, which is in emacs-like mode by default, and so you can probably use Control-R to do a reverse i-search (incremental search). Enter to invoke the command. Control-C to abort i-search.

If a search matches multiple candidates, tap Control-R multiple times to cycle back through results.

EDIT: Also, ! has a built-in search, so if you are sure of the starting string, you can just do that. I generally prefer to use the interactive search to confirm that I'm not invoking something wonky.

$ touch a
$ rm a
$ touch a
$ !rm
rm a
$ 
  • source
  • parent