Created
November 10, 2024 20:46
-
-
Save kangarie/54c1e1516bce8815aefb10e079b4b711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
command = "ps axo user:30,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,comm" | |
l = subprocess.check_output(["/bin/bash", "-c", command]).decode("utf-8").split("\n") | |
minlen = sorted(set([30-len(item.split(" ")[0]) for item in l]))[0] | |
for line in l: | |
print(line[:30-minlen]+line[30:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment