import subprocess output = subprocess.check_output("cat /etc/os-release", shell=True) output = output.decode("utf-8") print("Version info: ",output)