Making cd in bash a little better
Quick tips are random posts regarding something I discovered on my way to something bigger. They usually get longer than “quick” would imply, for which I refuse to apologize.
The Bash command cd
is pretty good with tab completion (though not as good as Z shell). I often want to complete a path like ~/Scripts/
, though, and get caught up on directories such as ~/ScriptingAdditions
, which I never need to get to through Terminal. There’s an easy way to ignore those pesky directories, though, using the $FIGNORE
variable.
In my .bash_profile
, I just include:
export FIGNORE="Application Scripts:Applications (Parallels):ScrivWatcher:ScriptingAdditions"
The directories listed in $FIGNORE
will always be ignored by cd
tab completion. Problem solved.
Ryan Irelan has produced a series of shell trick videos based on BrettTerpstra.com posts. Readers can get 10% off using the coupon code TERPSTRA
.