← All commands
Topic hub Networking
Windows Linux Networking

Windows Test-NetConnection equivalent in Linux

Checks whether a remote host and port accept connections, or whether an HTTP endpoint responds.

Windows Test-NetConnection
Linux equivalents
Debian/Ubuntu same command
nc -vz host port
Fedora same command
nc -vz host port
Arch same command
nc -vz host port

Overview

What this command does

Checks whether a remote host and port accept connections, or whether an HTTP endpoint responds.

Migration tip: Use nc -vz for a raw TCP port test and curl -I for HTTP or HTTPS response headers.

Practical tasks

Common use cases

Test a TCP port or web endpoint

Checks whether a remote host and port accept connections, or whether an HTTP endpoint responds.

nc -vz example.com 443

Test TCP port 443

curl -I https://example.com

Test an HTTPS endpoint

timeout 5 nc -vz 192.168.1.10 22

Apply a five-second timeout

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

nc -vz example.com 443
curl -I https://example.com
timeout 5 nc -vz 192.168.1.10 22

Walkthrough

Examples with explanations

nc -vz example.com 443 # test whether HTTPS is reachable
curl -I https://example.com # request HTTP response headers
timeout 5 nc -vz 192.168.1.10 22 # test SSH with a timeout

Reference

Common options and variations

Command or optionUse
nc -vz example.com 443Test TCP port 443
curl -I https://example.comTest an HTTPS endpoint
timeout 5 nc -vz 192.168.1.10 22Apply a five-second timeout

Distro differences

Debian/Ubuntu vs Fedora vs Arch

This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command nc -vz host port Same command on this distribution.
Fedora same command nc -vz host port Same command on this distribution.
Arch same command nc -vz host port Same command on this distribution.

Keep learning

Related Networking commands