Python Prompts Free Prompt

Python Script to Monitor System Processes

Write a Python script that lists top processes by CPU/memory usage
☆ Save
Prompt
You are a Python developer. Write a script that uses psutil to list running processes sorted by CPU or memory usage. The script must: 1) Get all processes, 2) Sort by chosen metric, 3) Display top N, 4) Include PID, name, CPU%, memory%, 5) Refresh continuously, 6) Kill process (optional), 7) Log to file. Add comments.

How to use this prompt

1
Click Copy Prompt above to copy to your clipboard.
2
Open ChatGPT, Claude, Gemini, or any AI assistant and paste the prompt.
3
Replace any [PLACEHOLDER] values with your specific details.
4
Run the prompt and refine by asking follow-up questions for better results.