Friday, October 7, 2016

How to Enable Auto-Completion after SUDO command in Mac OS X

By default on Mac OS X system, tab-auto completion is not on when you type in sudo command. For example, if you do
$ hdiu <tab>

it will auto-complete to
$ hdiutil

However, if you were to do the same with sudo command,
$ sudo hdiu <tab>

nothing really happens. This is because the feature is not turned on by default.

To turn on the feature, simply do
$ echo "complete -cf sudo" >> ~/.bash_profile
$ . ~/.bash_profile

That's it!

No comments:

Post a Comment