How to Enter Your Password for sudo in a Single Command



This content originally appeared on DEV Community and was authored by Lyner Lim

If you’re using the terminal on Linux or Mac, echo <password> | sudo -S <command>.

If you’re doing this programmatically, for example in Python, os.system(f'echo {password} | sudo -S {command}').


This content originally appeared on DEV Community and was authored by Lyner Lim