• some_guy@lemmy.sdf.org
    link
    fedilink
    arrow-up
    6
    ·
    5 months ago

    Here’s something I use to search history for commands or keywords. I have this as a function in my profile:

    function hgr() {
        history | grep "$1"
    }
    

    history grep

    Usage: hgr git to search for commands containing git.

    Someone more knowledgeable may be able to point out ways to improve this.

    • Will@lemmy.ml
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      5 months ago

      you can get a lot of the way there with Control+R reverse history search (mentioned in the article) – and it’s interactive. With fzf you can even get fuzzy history searching (the first search result has a video).