what's the difference between /bin/zsh and /usr/bin/zsh?

172

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

#!/bin/sh
...
case "$1" in
    (configure)
#    if test -z "$2"; then
            add-shell /bin/zsh
            add-shell /usr/bin/zsh
#    fi
...
Share:
172
zmii
Author by

zmii

Updated on September 18, 2022

Comments

  • zmii
    zmii almost 2 years

    During upgrading of react version from 0.13 to 15.4 nearly all dependencies are updated. And those changes also include e.g. react-bootstrap.

    As I know, errors in JSX in return statements are caught by React and in most of the cases I don't have any clues whats going on wrongly. All code seems to be perfectly fine, but I can't see result of component being rendered into actual DOM.

    How can I locate components that are causing error in return statements in React/JSX?

    • jdwolf
      jdwolf over 6 years
      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
    jdwolf over 6 years
    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.