DEV Community

Lyner Lim
Lyner Lim

Posted on

How to Enter Your Password for sudo in a Single Command

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}').

Top comments (0)