Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash cd command autocompletion for custom alias

Let's say I have a simple function serving as an alias to cd.

c(){ cd "$@"; }

How can I get the original autocompletion of cd work for my new function? Note that cd only autocompletes directory names, not simple file names.

I know about the complete command, but where exactly is the autocompletion function used by cd located?

Thanks for help!

like image 331
xixixao Avatar asked Aug 06 '26 05:08

xixixao


1 Answers

Look for /etc/bash_completion or /etc/bash_completion.d for the system-wide defaults.

like image 88
msw Avatar answered Aug 07 '26 21:08

msw