I saw the following in /etc/shells -

 % cat /etc/shells
# /etc/shells: valid login shells

I want to know if there is a difference betweem /usr/bin/zsh and /bin/zsh ?

I did chose /usr/bin/zsh as it has to be interactive login and CTE skills.

  • Yeah the dup doesn't actually address why. The fact that its symlinked makes for good backward compatibility but then why list it in shells twice? Unless that is ALSO for backward compatibility and if so that should be explained in an answer. P.S. Nvm one of the answers in dup does address that although only a blanket statement and of course isn't the accepted answer.
    – jdwolf
    Jan 3 '18 at 21:46

One of them is probably a link to the other...

Traditionally, shells (like bash, csh and zsh) are located in /bin - because a shell is needed even in single user mode or other times when /usr may be unmounted (/usr is often on a separate partition and may even be mounted through the network - thus not readily available in singe user mode).

On the other hand, additional shells (than the default one/ones) aren't strictly needed in single user mode (unless root happens to use one of them), so it's natural to put such shells it in /usr/bin instead of /bin.

When you do place it in /usr/bin though, it's common to provide a symbolic link to it from /bin, as users tends to expect their shells to be directly under /bin (not that a link would help if /usr wasn't mounted).

So when compiling the list of available shells to choose from (/etc/shells), both the real executable and the link have been listed. You can use ls -l to check what is the link and what is the executable.


Both /bin/zsh and /usr/bin/zsh are explicitly added together (same if-fi block) in the postinst (post-install) script for the zsh-package, using the add-shell command:

From zsh_5.1.1-1ubuntu2_amd64.deb:/DEBIAN/postinst

case "$1" in
#    if test -z "$2"; then
            add-shell /bin/zsh
            add-shell /usr/bin/zsh
#    fi
  • Yeah but isn't the more pertinent point why is it being listed twice in shells? if its the distributions choice to use for example /usr/bin/zsh then it should only list that.
    – jdwolf
    Jan 3 '18 at 21:43
  • @jdwolf edited my answer... Don't know why, but I found how... Jan 3 '18 at 22:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.