So I’m sure we’ve all spent time writing scripts or figuring out CLIs for that one project we’re working on, and then kind of go on to forget what we did. Then, when another project comes along later, you wish you had that script again so you could see how you did that thing you did.

Personally, I used to just check random scripts into a repo as a kind of “archive” of all my scripts. But I wanted a better way to organize and use these things.

For years I’ve been building and collecting these scripts into a CLI that I call Devtools to make it so that each script is a subcommand.

I’ve had a lot of my friends and coworkers ask me to open-source it so they could use it and see how some things are done in Bash, what tools I use, etc. So…here’s that CLI!


But what I’d honestly like is more…

So what are your useful scripts or CLIs you’ve built? Or what’s that script you wrote years ago that you now swear by? Or what’s that one application you use daily that just makes your life infinitely easier! I want to grow this collection and feed the addiction!

  • macattack@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    11 days ago

    Here are some of the ones I use most frequently that are somewhat unique:

    # Grep Bash files
    function rgb() { rg "$1" ~/.bash_aliases ; }
    function rgj() { journalctl -b0 --grep="$1" --no-pager; }
    function rgj4() { journalctl --since "4 hours ago" --grep="$1" --no-pager; }
    function rgj1d() { journalctl --since "1 day ago" --grep="$1" --no-pager; }
    function rgrc() { rg "$1" ~/.bashrc ; }
    function rgt() { rg "$1" ~/.taskrc ; }
    function rp() { rg "$1" ~/.bash_profile ; }
    
    # Sharing aliases across devices
    alias dba='diff -s ~/.bash_aliases  ~/Sync/.bash_aliases.bak|cat' # Diff between loaded vs saved
    alias ba2s='cp ~/.bash_aliases ~/Sync/.bash_aliases.bak'  # Replace saved w/ loaded
    alias s2ba='cp ~/Sync/.bash_aliases.bak ~/.bash_aliases' # Replace loaded w/ saved
    # I have the same for bashrc and taskrc and bash_profile as well for the most part altho they are used more sparingly