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 sudo.

2 Answers 2


No. Sudo draws from the root account and won't consult your user's ~/.bash_profile.

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.

  • I suppose you meant to type `alias sudo='sudo ', since that works! Change your answer accordingly and I will accept it.
    – Asmus
    Mar 24, 2012 at 19:05
  • @Asmus yes sorry. Fixed.
    – user10355
    Mar 24, 2012 at 20:45

alias sudo='sudo su -i ENV=/home/myuser/.profile'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .