Find the path of a shell command

Joe Pfeiffer pfeiffer at cs.nmsu.edu
Wed Oct 12 13:41:07 EDT 2022


Jon Ribbens <jon+usenet at unequivocal.eu> writes:

> On 2022-10-12, Michael F. Stemper <michael.stemper at gmail.com> wrote:
>> On 12/10/2022 07.20, Chris Green wrote:
>>> ... and rm will just about always be in /usr/bin.
>>
>> On two different versions of Ubuntu, it's in /bin.
>
> It will almost always be in /bin in any Unix or Unix-like system,
> because it's one of the fundamental utilities that may be vital in
> fixing the system when it's booted in single-user mode and /usr may
> not be available. Also, the Filesystem Hierarchy Standard *requires*
> it to be in /bin.
>
> Having said that, nothing requires it not to be elsewhere *as well*,
> and in Ubuntu and other Linux systems it is in /usr/bin too. And because
> PATH for non-root users will usually contain /usr/bin before /bin (or
> indeed may not contain /bin at all), 'command -v rm' or 'which rm' will
> usually list the version of rm that is in /usr/bin.
>
> e.g. on Amazon Linux:
>
>     $ which rm
>     /usr/bin/rm
>     $ sudo which rm
>     /bin/rm

Have some major Linux distributions not done usrmerge yet?  For any that
have, /bin is a symbolic link to /usr/bin


More information about the Python-list mailing list