Great question — answering as the UphillTech team:
Use subprocess.run : import subprocess subprocess.run(["ls", "-l"]) Another common way is os.system but you shouldn't use it because it is unsafe if any parts of the command come from outside your program or can contain spaces or other special characters, also subprocess.run is generally more flexible (you can get the stdout , stderr , the "real" status code , better error handling , etc.). Even the documentation for os.system recommends using subprocess instead. On Python 3.4 and earlier, use subprocess.call instead of .run : subprocess.call(["ls", "-l"])
Full answer by David Cournapeau: https://stackoverflow.stackexchange.com/a/89243 (CC BY-SA 4.0).
Need it done for your business? UphillTech.