This task can be performed using ProcessSpy
Monitor macOS processes like a pro
Best product for this task

ProcessSpy
dev-tools
Monitor macOS processes, command line arguments, open files, run shortcuts on process/start finish, find process by clicking mouse anywhere on the screen
What to expect from an ideal product
- Runs shortcuts automatically when a process starts or finishes.
- Monitors all macOS processes and their command line arguments.
- Keeps track of open files for each process.
- Allows you to identify any process by simply clicking it on your screen.
- Provides real-time insights and control over process activities.