Jump to content
Sign in to follow this  

Task details grep-like output filtering

Recommended Posts

Say you are checking you tasklist output for a certain Windows process id (pid) that matches your netstat -o output.  These commands are helpful but matching the output can be annoying, even if you output them to a text file.  By the way, context wise this process is a throwback to the Bitcoin Miner Malware removal thread, as it could help for any open port you want to reference back to a running process.

If you want to see what said PID in your netstat output is with a single CLI string, here is a helpful pipe option.
tasklist | findstr "PID#"

IE: running tasklist | findstr "812" on my system throws details on wininit but also shows other process IDs with 812 in them.

I think of this as a light grep-like command you can do in Windows.  Like Linux, '|' (piping) will take the output of your first command and run the 2nd command against it.  The tasklist find is a common and moderately easy grep-like thing you may want to do often if you are checking a machine for open ports and trying to correlate what process details are for said PID linked to those open ports.

Share this post

Link to post
Sign in to follow this