How can I let
sudo use my existing aliases in my .bash_profile (or .bashrc, .profile …)?
For example I want to be able to use
ll instead of
ls -laGF as
No. Sudo draws from the root account and won't consult your user's
But you can workaround this problem by adding the following alias to your profile:
alias sudo='sudo '
*Note the space after the command. From then on,
sudo will work normally and you'll be able to use your user's aliases without issue (both normally and with root privileges).
Explanation: http://www.gnu.org/software/bash/manual/bashref.html#Aliases says:
If the last character of the alias value is a space or tab character, then the next command word following the alias is also checked for alias expansion.
alias sudo='sudo su -i ENV=/home/myuser/.profile'