🕹ī¸ Do Something Great! 😄

Tag: history

  • Searching bash history when it’s in multiple files

    When I look for previous commands that I have ran in bash, I use history | grep COMMAND. That works well when you’re history is in one file, but I now save my history in multiple files from each shell and my simple command doesn’t work.

    With my history files saved in ~/.bash_history_log/ I needed a different solution. The one I came up with is grep -ri COMMAND ~/.bash_history_log/*. That seems awfully long, lets make it shorter. You can’t pass arguments to bash aliases, but you can to functions. In .bash_profile (or .bashrc, which ever runs for you by default) I added the following function:

    function searchhistory() {
        grep -ri "${1}" ~/.bash_history_log/*
    }
    alias shistory=searchhistory
    

    And now a simple shistory COMMAND is all it takes to find that command I ran a long time ago.

  • History teacher and class discover Boston’s own Forest Gump

    The Briefcase

    …they slowly uncovered the life of a man who not only oversaw the liberated Dachau but also found himself a participant in an uncommon number of consequential events throughout Massachusetts and U.S. history. In a way Delaney couldn’t have imagined when he first popped open the suitcase that day, Joyce would turn out to be something akin to Boston’s own Forrest Gump, a perfect set of eyes through which to visit America’s past.

    What an amazing find and a great way to engage the students!