Find the path of a shell command

rbowman bowman at montana.com
Wed Oct 12 22:08:24 EDT 2022


On 10/12/22 09:06, Chris Green wrote:
> 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.
> 

ls -l /bin
lrwxrwxrwx 1 root root 7 Sep 23 01:41 /bin -> usr/bin





More information about the Python-list mailing list