3

I have a couple of aliases setup in my ~/.bash_profile and the same exact ones setup in /root/.bash_profile so I can do v file instead of vim file and etc.

These work fine when I am actually logged in as those users, but when I do something like sudo v file, sudo cannot figure out the alias and fails.

Is there a way for sudo to understand aliases?

1 Answers1

4
echo "alias sudo='sudo '" >> ~/.bashrc
. ~/.bashrc

man bash

If the last character of the alias value is a blank, then the next command word following the alias is also checked for alias expansion.

quanta
  • 51,413
  • 19
  • 159
  • 217