Find the path of a shell command

Chris Green cl at isbd.net
Wed Oct 12 11:06:35 EDT 2022


Michael F. Stemper <michael.stemper at gmail.com> wrote:
> On 12/10/2022 07.20, Chris Green wrote:
> > jak <nospam at please.ty> wrote:
> >> Il 12/10/2022 09:40, jkn ha scritto:
> >>> On Wednesday, October 12, 2022 at 6:12:23 AM UTC+1, jak wrote:
> 
> >>>> I'm afraid you will have to look for the command in every path listed in
> >>>> the PATH environment variable.
> >>>
> >>> erm, or try 'which rm' ?
> >>
> >> You might but if you don't know where the 'rm' command is, you will have
> >> the same difficulty in using 'which' command. Do not you think?
> >  From a command prompt use the bash built-in 'command' :-
> > 
> >      command -v rm
> > 
> > ... and rm will just about always be in /usr/bin.
> 
> On two different versions of Ubuntu, it's in /bin.
> 
I think you'll find it's in both /bin and /usr/bin, usually /usr/bin
is earlier in the path so /usr/bin/rm is the one that will normally be
found first.

It's only in /bin/rm in case one has a system which mounts /bin
separately and earlier in the boot sequence and rm is one of the
commands needed early on.

-- 
Chris Green
·


More information about the Python-list mailing list