[SOLVED] default zsh alias for dir?

Issue

On a Linux host system the default zsh install provides an alias to ‘dir’. It is ‘ls -l’.

I cannot find the system startup file that is responsible for setting this alias.

/etc/zsh/* files have nothing related.

The way I found out about the default alias is that I have a zsh shell function defined in my .zshrc, like this:

dir () { ls … | less …}

Now, with the default alias this results in ls being defined with ls and the circular reference prevents ls being used at all.

I fixed this by adding ‘unalias dir’ prior to defining dir().

However, I am still frustrated and wish to find the source of the alias created for dir.

Could you help?

Solution

Thanks user1934428! Using zsh -lx I found the culprit.

The /etc/zprofile sourced /etc/profile which sourced /etc/bash.bashrc which sourced /etc/profile.d/ls.bash, which had the alias definition.

I argue that the zsh shell function definition should ignore aliases on the function name; that almost never could be the right thing to do…

Answered By – Matyas

Answer Checked By – Marie Seifert (BugsFixing Admin)

Leave a Reply

Your email address will not be published.