SSH Command in Windows with examples

Networking commands in Windows

Check addresses, DNS, ports and connectivity.

#ipconfig

Network addresses

Syntaxipconfig [/all]
  • ipconfigCMD

    Addresses and gateway

  • ipconfig /allCMD

    Everything including MAC address and DNS servers

  • ipconfig /flushdnsCMD

    Clear the DNS cache

  • ipconfig /release && ipconfig /renewCMD

    Ask the router for a new address

#ping

Test if a host answers

Syntaxping host
  • ping example.comCMD

    Four packets

  • ping -n 10 example.comCMD

    Ten packets

  • ping -t 8.8.8.8CMD

    Keep going until Ctrl+C

#tracert / pathping

Show the route

Syntaxtracert host
  • tracert example.comCMD

    Every hop

  • pathping example.comCMD

    Route plus packet loss at each hop

#nslookup / Resolve-DnsName

DNS lookups

Syntaxnslookup name
  • nslookup example.comCMD

    Resolve a name

  • nslookup -type=MX example.comCMD

    Mail servers

  • Resolve-DnsName example.comPowerShell

    PowerShell DNS lookup

#netstat

Connections and ports

Syntaxnetstat [options]
  • netstat -anoCMD

    All connections with the owning process number

  • netstat -ano | findstr :443CMD

    Who uses port 443

  • netstat -an | findstr LISTENINGCMD

    Listening ports

  • Get-NetTCPConnection -State ListenPowerShell

    Listening ports in PowerShell

#Test-NetConnection

Test a port

SyntaxTest-NetConnection host -Port N
  • Test-NetConnection example.com -Port 443PowerShell

    Is the port reachable?

  • Test-NetConnection 203.0.113.10 -Port 22PowerShell

    Check that SSH is reachable

#curl / Invoke-WebRequest

Talk to web servers

Syntaxcurl [options] URL
  • curl -I https://example.comCMD

    Only the headers (curl.exe ships with Windows 10 and 11)

  • curl -o file.zip https://example.com/file.zipCMD

    Download a file

  • Invoke-WebRequest https://example.com -OutFile page.htmlPowerShell

    Download in PowerShell

#netsh

Network settings

Syntaxnetsh [context] [command]
  • netsh interface ip show configCMD

    IP settings

  • netsh wlan show profilesCMD

    Saved Wi-Fi networks

  • netsh advfirewall show allprofilesCMD

    Firewall state

#arp / route

Address and route tables

Syntaxarp -a | route print
  • arp -aCMD

    Devices recently seen on your network

  • route printCMD

    The routing table

#Windows Firewall

Open a port

Syntaxnetsh advfirewall firewall
  • netsh advfirewall firewall add rule name="SSH" dir=in action=allow protocol=TCP localport=22CMD

    Allow incoming SSH (administrator)

  • New-NetFirewallRule -DisplayName "SSH" -Direction Inbound -Protocol TCP -LocalPort 22 -Action AllowPowerShell

    The PowerShell equivalent

#net use

Network drives

Syntaxnet use drive: \\server\share
  • net use Z: \\server\shareCMD

    Map a drive

  • net use Z: /deleteCMD

    Disconnect it

  • net useCMD

    List connections

Run these commands with SSH Command

SSH Command is a desktop app for Mac, Windows and Linux that puts a real terminal, SFTP file panes, a sudo switch and a searchable Linux command finder in one window. Type what you want to do, and send the command to your server with one click.

Download free Linux commands with examples SFTP & FTP client