No Alias's when sudo'ing

Posted by Danny Roberts on Ask Ubuntu See other posts from Ask Ubuntu or by Danny Roberts
Published on 2011-01-17T22:47:13Z Indexed on 2011/01/17 23:00 UTC
Read the original article Hit count: 508

Filed under:
|

I was playing around with aliases today and I noticed that aliases don't seem to be available whilst using sudo:

danny@kaon:~$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
danny@kaon:~$ ll -d /
drwxr-xr-x 23 root root 4096 2011-01-06 20:29 //
danny@kaon:~$ sudo -i
root@kaon:~# ll -d /
drwxr-xr-x 23 root root 4096 2011-01-06 20:29 //
root@kaon:~# exit
logout
danny@kaon:~$ sudo ll -d /
sudo: ll: command not found

Is there any reason why you cannot use aliases whilst using sudo?

© Ask Ubuntu or respective owner

Related posts about sudo

Related posts about alias