💾 Archived View for thrig.me › blog › 2024 › 04 › 16 › history-in-shell-programs.gmi captured on 2024-05-12 at 15:15:35. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-05-10)

-=-=-=-=-=-=-

History in shell programs

    $ grep HIST ~/.kshrc
    unset HISTFILE
    HISTSIZE=64
    LESSHISTFILE=-

Yes, I've mostly disabled the shell history. If it's important, it needs to be in a script, Makefile, or documentation. Or possibly all of the above. (In a work environment I would maintain a very detailed history, probably in ZSH, as there will be questions about who did what when when multiple sysadmins are involved with multiple systems. But that's a different story.)

    [quintin] Counter argument.. using your history search to find a
              command and save keystrokes

Yes, I used to do that, and it may turn into a huge history across multiple shell instances on multiple machines and maybe backups of that history and search and… have you looked at what the history contains?

    vi `which brogue`
    brogue
    cd share/video/music/
    recent
    mpvnv Domenico_Scarlatti_-_Harpsichord_Sonatas_-_Igor_Kipnis_Part_1-\[MfuZL_RZwIw\].mp4
    anonradio
    sv 25 ff 80
    cd
    ow g velociraptors
    cat `which dim`
    cd var/gemini/thrig.me/blog/2024/04/15/
    vi pantheon.gmi
    commit -m 'blog - pantheon'
    pushgem
    ow g shakey the robot
    mutt
    vi ~/tmp/history-in-shell-programs.gmi
    grep HIST ~/.kshrc
    blog ~/tmp/history-in-shell-programs.gmi
    ...

Important stuff. None of this is worth saving. What is? Here you might step back and think about what commands you run, what things you fiddle around with in your history, and whether any of that could be a script, better documented, or put into a build system or configuration management. This is how I got to my present "nope, don't use the shell history except for single instance short-term recall" state. A bunch of things did get put into scripts, better documented, etc.