How-to Emulate the TOP command in Windows

On April 6, 2011, in How-to, Scripting, by Cubert aka (Cube Dweller)

Top is a Linux process that shows a list of processes running on the system and what levels of resources are being used. This application provides all processes running, the CPU and Memory consumed and with several switches available you can see things like the location of the executable that is running.

Unfortunately, they don’t make a TOP executable ported for Microsoft Windows but don’t despair.   You can use Power Shell to script a simple TOP style display that operates just like TOP on a Linux system.

 

Here is the one liner you need to get a top style process viewer running on windows.

while (1) { ps | sort -desc cpu | select -first 30; sleep -seconds 2; cls }

 

Copy the above line and paste it in to your Power Shell console. You should see something similar to the following image.

Tagged with:
 

3 Responses to “How-to Emulate the TOP command in Windows”

  1. Mahfooz says:

    Can u explain this in a little more detail like what is the exact information being displayed in each column here and can I write the results to some text file and can this command be configured to execute after a given interval automatically

  2. Mahfooz says:

    Can u explain this in a little more detail like what is the exact information being displayed in each column here and can I write the results to some text file and can this command be configured to execute after a given interval automatically

  3. After the first refresh the title row disappears, how do we pin it?

Leave a Reply

*



%d bloggers like this: