How to ping and test for a specific port in Linux?

The ping command can not be used to ping a specific port. Followings are some other ways to ping to specific port.

ping port using telnet command

telnet <HOST> <PORT>
telnet 80
telnet 80

Ping using nc command

nc -vz <HOST> <PORT>
nc -vz 80
nc -vz 443

Ping port using nmap command

nmap -PNp <HOST> <PORT>
nmap -p <HOST> <PORT>
nmap -p 443
nmap -p 443

Use bash shell to check port

(echo >/dev/tcp/<HOST>/<PORT>) &>/dev/null && echo "open" || echo "close"
(echo >/dev/udp/<HOST>/<PORT>) &>/dev/null && echo "open" || echo "close"
(echo >/dev/tcp/ &>/dev/null && echo "Open 443" || echo "Close 443"

Use nping command

sudo nping --tcp -p <PORT> <HOST>
sudo nping --tcp -p 443