bash aliases foor root - where they are defined?

Hi all,

Output of my #alias command looks just as normal as one would expect:

alias +='pushd .'
alias -='popd'
alias ..='cd ..'
alias ...='cd ../..'
alias beep='echo -en "\007"'
alias cd..='cd ..'
alias dir='ls -l'
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls='ls $LS_OPTIONS'
alias ls-l='ls -l'
alias md='mkdir -p'
alias o='less'
alias rd='rmdir'
alias rehash='hash -r'
alias unmount='echo "Error: Try the command: umount" 1>&2; false'
alias you='if test "$EUID" = 0 ; then /sbin/yast2 online_update ; else su - -c "/sbin/yast2 online_update" ; fi'

And still whenever i (as root) type in bash
which would be short for
#ls- l
i get output of the command
#ls -al

So where aliases for root overwritten? Usually i would expect .bashrc in the /root directory. Or at least .alias file. But there none of those in my current /root.

So, my question is where root user gets it’s aliases from?

This concerns only root user. Normal user has .bashrc and i made up my own aliases in .alias and that’s works jut fine. And yes i could make .bashrc file in the /root and .aliases where i would define my own things. But that’s not my quiestion.


IIRC this is not done with an alias (as you have proven for yourself), but somewhere in the* ls *tool. I am allready looking for it in the man page, etc, but fail to find it untilnow. I will cary on ;).

grep -A 5 ‘dir=’ /etc/bash.bashrc

It is a bit vague to me. As said, I somewhere remember that this is normal behaviour of the* ls* tool for root (and has nothing to do with aliases).

But I can find nothing about this “feature” in the* man 1 ls*.

In *man 1p ls *I can find:

Write out all directory entries, including those whose names begin with a period ( ‘.’ ). Entries beginning with a period shall not be written out unless explicitly referenced, the -a option is supplied, or an implementation-defined condition shall cause them to be written.
which means to me that you may program such a feature in* ls* and be still within the POSIX standard. But it does not explain of course if such a thing is done in the* ls* implementation we use.

In an old HP-UX manual I found:

If you are a user with appropriate privileges, all files except . and … are listed by default.

Which is a bit vague again, but I interprete this as: when you are root you get the files * .** except* .* and* …* .

In any case, in my many years of Unix system management I am used to this behaviour. And it is handy. Because contrary to the normal user, where hiding these files away in day to day usage makes live easier, as root you realy want to see everything before you make errors or jump to conclusions (like: “O, there is nothing there, I can delete the directory”).