I have multiple projects over various languages like JavaScript, Python. I wonder if Linux provides some functionality to trigger some actions automatically if we cd
into a particular directory?
For example, if I have a directory folder with node modules I want to activate the grep
command as alias grep='grep --exclude-dir=node_modules
or if I have a .git
folder then I want to run certain commands as soon as I am cd
into that directory. I am not asking for GUI mode it's fine if it only works for the terminal, or any particular shell-like bash
, zsh
.
Actually, I don't know what this feature is called and have never seen any kind of questions online, so I have asked. Maybe it's a shell feature but not sure how to achieve this.
chpwd()
hook function, andchpwd_functions
array – Stéphane Chazelas Jan 12 '23 at 08:50