How to Monitor a Process in Real Time with PowerShell
Monitoring a process in real time lets you watch its resource use change moment to moment, which is helpful when observing how a program behaves under load. PowerShell can repeatedly sample a process and update the display, creating a simple live monitor.
The Command
while ($true) { Get-Process notepad | Select-Object Name, CPU, WS; Start-Sleep -Seconds 2; Clear-Host }
What It Does
This runs a loop that never ends on its own. Each cycle it shows the Notepad process’s name, CPU time, and memory, waits two seconds with `Start-Sleep`, then clears the screen with `Clear-Host` before repeating. The TANGKAS39 effect is a display that refreshes every two seconds, letting you watch the process’s resource use update live.
When You’d Use This
This suits watching how a specific program’s resource use changes over time, such as observing whether an application’s memory grows steadily or how it responds under load. A live, refreshing view is more informative than single snapshots when you are trying to understand a process’s behavior, making it useful for diagnosing gradual slowdowns or memory leaks in a particular program.
Useful Variations
Change `notepad` to the process you want to watch, and adjust the `-Seconds` value to sample faster or slower. To monitor several processes, list them or remove the name filter to watch all. Press Ctrl+C to stop the loop when you are done, since it runs indefinitely otherwise.
If It Doesn’t Work
Remember the loop runs forever until you press Ctrl+C to stop it, so do not leave it running unattended. If the display flickers or updates too fast, increase the `-Seconds` value for a calmer refresh. If the process name is not found, it may not be running, so confirm it is active first, and adjust the name to match exactly, without the .exe.
Good to Know
Because the loop runs forever until stopped, remember to press Ctrl+C to end it. Very short sleep intervals refresh rapidly but use more resources themselves, so a couple of seconds is usually a good balance for observing trends without adding noticeable load.
Putting It Together
The command shown may look dense at first, but it breaks down into clear parts once you have used it a few times. As part of understanding and controlling what runs on your PC, this command is one you will return to whenever the system feels slow or a program misbehaves. Paired with the related process commands, it gives you a full command-line alternative to Task Manager for diagnosing and managing what is running. Like anything in the terminal, the real value comes from trying it on your own system and adapting the variations above to what you actually need, so it is worth experimenting with in a safe, low-stakes situation before relying on it in a script or during troubleshooting. Keeping a note of the commands you find most useful, along with the variations that fit your workflow, turns scattered one-off tricks into a personal reference you can draw on whenever a similar task comes up again.