Python Forum
Getting wanted data from the 'top' command (Linux)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting wanted data from the 'top' command (Linux)
#8
It's cool to build own tools. Additionally you can explore linux and learn how to handle pathlib for example.

def lspids():
    pids = []
    for path in pathlib.Path('/proc').iterdir():
        if path.name.isdigit():
            pids.append(int(path.name))
    return pids
Now you can explore the subdirectories of pids in /proc.
You should look here: http://tldp.org/LDP/Linux-Filesystem-Hie.../proc.html
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: Getting wanted data from the 'top' command (Linux) - by DeaD_EyE - Nov-19-2018, 09:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Command output to pdf (linux) Gribouillis 0 4,998 Mar-05-2021, 07:35 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020