Useful PowerShell command for every developer

In this article, I will share the PowerShell command that I used every day in my development. Instead of going to google and search for the command, I keep this in my notepad. So, I will share these commands.

Find the IP4 Address of your system.

If you want to get the IPV4 address of your machine, you can use the following command. It’s convenient and practical.

Get-NetIPAddress -AddressFamily IPV4

Get-Process Name From the PORT number

While profiling the ASP.NET application, I need the port number of the application that my application is using. Use the following Powershell command to get the port number of your process/application.

Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess

Find Process Details by Name

If you need the details of your process, like the port number the application is running or how much memory the application is using like this, you can use the following command to get the details of the process.

 Get-Process | Where-Object {$_.Name -like 'chro*'}

Kill process from the command line

Every developer must know this command. If you face a problem with the application and want to close/kill the application, you can use the below command. In the below example, I am closing the notepad application.

 Stop-Process -name notepad

Find CPU Usage

If you face the slowness of your system, you can use the below command to see which application is consuming your system resources. In the below command, I am listing the top 5 orders by their memory usage.

 Get-Process | Sort  WorkingSet -Descending | select -first 5 -Property ProcessName,ID | Format-Table -AutoSize

Download file from the server

Sometimes I need to download some file from the webserver. Instead of opening the browser and downloading the file, I prefer the curl command to download the file.

curl -OutFile a.html

Make HttpRequest from Command Line

Sometimes I need to check server is responding or not. I used the following command.


Check Header Response

If you want to check the header details of any application, you can use the following curl command with the option -Head

curl -Method Head

Using the specified port, find the application’s process ID.

Assume you are working on the application and you get the error that the port is already in use. You can get the process ID of the program using the following command.

netstat -ano | findStr "PORT_ID"

Please do not post any spam link in the comment box😊

Post a Comment (0)
Previous Post Next Post