Find the path of a shell command

Andreas Eder a_eder_muc at web.de
Sat Oct 15 12:13:32 EDT 2022


On Mi 12 Okt 2022 at 05:00, Paulo da Silva <p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt> wrote:

> The simple question: How do I find the full path of a shell command
> (linux), i.e. how do I obtain the corresponding of, for example,
> "type rm" in command line?
>
> The reason:
> I have python program that launches a detached rm. It works pretty well
> until it is invoked by cron! I suspect that for cron we need to specify
> the full path.
> Of course I can hardcode /usr/bin/rm. But, is rm always in /usr/bin?
> What about other commands?

Why not just use os.unlink ?

'Andreas


More information about the Python-list mailing list