Category: Command-line Interface
-
How to push an empty git commit
We’ve all been there. We need to trigger something from a commit to a git repository, and instead of triggering the build directly, we end up tweaking something in a file, committing it, and pushing it. It’s usually just adding a blank line (and subsequently removing it, depending on where…
-
Migrating from aws ecr get-login to aws ecr get-login-password
I’m not entirely sure when the change happens, but recently as I was upgrading AWS CodeBuilds to use a newer version of Ubuntu, I ran into some problems with aws ecr get-login. Without making any code changes, my build started to fail with the following: [Container] 2021/06/21 20:44:19 Running command…
-
Using find with symbolic links
Symbolic links, or symlinks come in handy when you need to share directories with multiple directories and not have to worry about keeping each linked instance in sync. The problem with symlinks is that not every command-line utility supports them, and often times, they do support them, but it’s not…
-
How to push to multiple git repos at once
A while back I fell in love with GitLab, specifically their GitLab Runners. This was at a time before GitHub had GitHub Actions, so I decided to move the majority of my git repositories over to GitLab. Fast forward a few years, GitHub has Actions, and more importantly, it seems…
-
Run command instead of alias
Recently, a buddy of mine was having some issues with Homebrew after upgrading to Big Sur. After doing the Googling he could have done on his own, I came to realize that he needed to manually upgrade to the latest version, that was compatible with Big Sur. He said he…
-
Case statements in shell script
While I do love the command-line, and will throw shell script at most problems if it’s the right tool for the job, it’s actually fairly rare that I write case statements. Generally speaking, my shell scripts will usually interrogate a variable or two, never too crazy or anything. With that,…
-
Delete all files in an S3 bucket
Last year I had sunset a project that was using both AWS’ S3 and Linode’s S3-compatible object storage offering. After pulling down some final snapshots, I wanted to delete the buckets on both services. Similar to the error you receive when you attempt to rmdir a directory with files in…
-
Search and replace filenames
Recently, while working with a bunch of files, I came to realize that I needed to rename every single file. Not just that, I only needed to rename a small bit of the filename. If I was working with a document, I wound have leveraged a “search and replace” feature,…
-
Counting files in multiple directories
Last week I discussed counting files in the current directory. It was a quick and dirty way to get the number of files in a directory with some pretty strong assumptions about the type of files / directories that your current directory contained. Sure, it was a short sighted in…
-
Counting files in the current directory
As the year comes to a close, I like to look back and see how many blog posts I have written for the year. My blog is powered by Jekyll and I like to keep my posts organized by year, in directories. With all of my posts in one place,…