How to Enter Your Password for sudo in a Single Command
Lyner Lim
Posted on October 26, 2024
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}')
.
💖 💪 🙅 🚩
Lyner Lim
Posted on October 26, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.