Skip to content
Zepe

Command line

Four things on Windows are commonly called 'the terminal' and they are not interchangeable. Command Prompt is a shell, PowerShell is a different shell, Windows Terminal is a window that hosts either of them, and WSL is a Linux environment running alongside Windows. Instructions that assume the wrong one fail in confusing ways.

These guides start by making that distinction concrete, then cover the tasks that genuinely need a command line: identifying the process holding a network port, killing something the graphical tools cannot, and running scripts written for a Unix shell.

Commands are given complete, with the output you should expect, so you can tell success from a silent failure.

What you'll learn

  • The practical differences between Command Prompt, PowerShell, Windows Terminal and WSL
  • How to open any of them as administrator, and directly inside a chosen folder
  • How to trace a port to a process ID and end it, in both cmd and PowerShell syntax
  • How to run a .sh script on Windows, and why line endings break scripts copied from Windows editors
  • How to read command output well enough to know whether something actually worked

3 guides in command line

  • How to Open the Terminal in Windows

    Open Command Prompt, PowerShell, Windows Terminal or WSL on Windows 10 and 11 — including as administrator and directly inside a chosen folder.

    Command lineUpdated

  • How to Kill a Process Using a Port in Windows

    Find what is holding port 3000, 8080 or any other port on Windows with netstat -ano, then end it with taskkill — plus the PowerShell one-liner equivalent.

    Command lineUpdated

  • How to Run a Shell Script (.sh) on Windows

    Run .sh files on Windows using WSL, Git Bash or Cygwin — how they differ, and how to fix the CRLF line-ending error that breaks scripts edited on Windows.

    Command lineUpdated

Questions about command line

Should I use Command Prompt or PowerShell?

PowerShell for anything new. It is more capable, and it accepts most familiar commands because names like dir and cls exist as aliases. Command Prompt still matters when you are following older instructions or running a tool that parses its specific output format.

Do I always need to run the terminal as administrator?

No, and it is worth not doing so by default. Administrator is required for changes affecting the whole system — services, protected folders, ending another user's processes. Ordinary work in your own files does not need it, and running elevated all the time removes a useful safety net.

Is WSL a virtual machine?

WSL 2 runs a real Linux kernel in a lightweight managed VM, so effectively yes, though it does not feel like one. It starts in about a second, shares your filesystem, and needs no separate window. WSL 1 was a translation layer instead, with better file interoperability but weaker compatibility.

See all 8 topics →