Toolkit links – zsh

I’ve been teaching myself Python this summer, to support some of the things I need to do for my product. And while much of my learning experience conformed to the stereotypes about developers (cough Google cough StackOverflow), there have still been a few useful things I’ve learned along the way that were worth linking and writing down.

Maybe the most useful things I learned were at the humble shell. Here’s a few things I picked up and how I applied them:

Updating the path in MacOS Catalina – after installing a newer Python version, I couldn’t figure out why pip and other commands weren’t working. Path update to the rescue! Adding the directory where the Python install places the unversioned symlinks did the trick.

Searching command history in zsh – I have no idea how I lived this long without knowing this was possible. I was searching backwards to find this syntax…

Recursively zipping only certain files in a directory – Let’s say you have a code scanner in the cloud and you want to feed it all the code, but none of the git history, media and other fun stuff in the directory. This command to the rescue! And ultimate that led me to…

zsh functions – shell aliases on steroids! These little command shortcuts are tasty and addictive. Here was my zip function:


vczip () {
        zip -R $1.zip '*.py' '*.html' '*.js' 'requirements.txt' '*.json' '*.lock' '*.ts'
}

And then calling it is just as simple as typing vczip zipfilename in the appropriate directory.

Hardly rocket science, but definitely productivity enhancing.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.