How to Customize Your Bash Aliases Based on the Current Directory

A computer mouse on a desk with hands on a keyboard slightly blurred in the background.
Hate it!
  • When using the terminal, I should have access to the aliases defined in the current directory and those defined anywhere above the current directory.
  • Aliases that are defined lower in the tree (i.e. in a more-specific folder) should override aliases with the same name that are defined higher in the tree.
  • Aliases defined in my home directory should always be included, even outside that directory.
  • Aliases should automatically update themselves whenever I change directories in the terminal.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amanda Reilly

Amanda Reilly

Software engineer. Great British Baking Show enthusiast. Obsessed with Beat Saber. Powered by insatiable curiosity and too much Diet Coke.