Local bash aliases
It's been around for ages, but I recently discovered Localized Aliases for Bash. And it's amazing.
My .bash_profile
/.bashrc
is enormous, and a not-so-insignificant portion of it, is aliases. aptu
equals apt update && apt upgrade
, for instance. And then there are the kinds of aliases that are useful, but also super clumsy. For instance, dev
which equals npm run dev
. Since it's only valid in specific folders, there's no point in having that alias, but I use it in so many folders that it's a trade-off I'm willing to make.
That is, until I discovered Local Aliases.
If you're on a Mac, like my dev environments are, it's as simple as brew install sebglazebrook/aliases/aliases
. If you're on Debian it's just a deb package. If you're on something other than Mac or a Debian-based system... well, I would question your life choices.
After that, all you need to do in order to create one or more local aliases, is to run aliases init
within that folder. That'll generate a .aliases. Open this and edit as the comment tells you to. Then save it, run aliases rehash
, and you'll have new local alias(es). And it works beautifully.
Now, the Git repo hasn't been updated in over 3 years, but Bash isn't exactly sprawling with new features either, so compatibility shouldn't be an issue.