Skip to content

U00A/task-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Task Manager (taskmgr.py)

A simple cross-platform Python script to list running processes with memory usage, optional Windows session lookup, and interactive sorting.

Features

  • Lists processes with PID, session name (Windows, optional), memory usage, and state.
  • Sort by memory (default), PID, or name.
  • Interactive prompt to choose ascending/descending order when run in a terminal.
  • CLI flags to control sorting, order, and limit output.

Requirements

  • Python 3.8+ (tested with Python 3.11/3.13)
  • Python packages (see requirements.txt):
    • psutil
    • tabulate
    • pywin32 (optional, Windows only, for session/username lookup)

Installation (recommended)

Open PowerShell in the project folder (where taskmgr.py and requirements.txt live).

  1. Create and activate a virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1

If activation is blocked by policy, run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  1. Upgrade pip and install requirements
python -m pip install --upgrade pip
pip install -r .\requirements.txt

Quick usage

Run the script (interactive prompt appears if in a terminal):

python taskmgr.py

Command-line options

  • --sort {memory,pid,name} — Field to sort by (default: memory)
  • --order {asc,desc} — Explicit sort order (overrides interactive choice)
  • --reverse — Reverse sort order (alias)
  • --no-prompt — Don't prompt interactively; use defaults or provided flags
  • --top N — Show only the top N entries after sorting

Examples

  • Default (interactive prompt for asc/desc):
python taskmgr.py
  • Non-interactive, ascending by memory (default):
python taskmgr.py --no-prompt
  • Show top 5 by memory descending:
python taskmgr.py --order desc --top 5 --no-prompt
  • Sort by PID ascending:
python taskmgr.py --sort pid --no-prompt

Notes

  • On Windows, installing pywin32 enables session/username lookups. If not present the script will display N/A for session names.
  • Running pipx install --editable . will fail without a pyproject.toml or setup.py. Use the virtualenv approach above instead.

Troubleshooting

  • Activate.ps1 cannot be loaded → run PowerShell as Administrator or run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser.
  • Permission denied installing packages → use a virtualenv or run PowerShell as Administrator.
  • If pip installs to a different Python, run python -m pip install ... to ensure packages are installed for the same interpreter you run the script with.

Contributing / Improvements

  • Add CPU usage column and sorting by CPU
  • Add filtering options (by name, state)
  • Add a packaged CLI with pyproject.toml for pipx installation

If you'd like, I can:

  • Run the installation commands in your terminal now
  • Add a pyproject.toml so pipx install --editable . works
  • Add CPU usage or owner username columns

Tell me which and I will proceed.

About

simple task manager for basic use (it's just a basic stuff) using python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages