I read multiple answers regarding how to run the linux shell command using subprocess module in python. In my case, i need to run linux shell commands inside my python code in such a way that these commands should get executed in new terminal.
subprocess.call(["df","-h"]
I'm running say xyz.py in base terminal, when i execute above command, it overwrites on the output of xyz.py in the same terminal. I want this command to be executed in different terminal, or i want to store output of this command in a text file.
subprocess.call(["df","-h",">","somefile.txt"])
Above command is not working.
Edit-1: If i save the output in a text file, i also have to display it through python.
Thanks!