xxxxxxxxxx
ps -aux
# (print all processes owned by a user named "x")
xxxxxxxxxx
# memory usage (in percentage) of all the process running with pid
ps -o pid,user,%mem,command ax | sort -b -k3 -r
# all running process
ps aux
# Memory usage of a specific pid(917 is an example here process)
sudo pmap 917 | tail -n 1
xxxxxxxxxx
import subprocess
# Use the "ps" command in Linux to get the list of running processes
process = subprocess.run(['ps', 'aux'], capture_output=True, text=True)
# Print the output
print(process.stdout)