How to Check Remote Ports are Reachable Using ‘nc’ Command

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

6 Responses

  1. Timir Mazumder says:

    Hi,

    I have Red Hat Enterprise Linux Server release 7.3 (Maipo) installed on my PC.

    When I try either of the below commands, I get the error message as shown:

    # ncat -z 127.0.0.1 5556
    # nc -z 127.0.0.1 5556
    

    Error Message:
    nc: invalid option — ‘z’
    Ncat: Try `–help’ or man(1) ncat for more information, usage options and help. QUITTING.

    ‘–help’ or man() did not provide any details on how to simply scan for listening daemons.

    Any suggestions?

    • Aaron Kili says:

      @Timir

      When you open the man page, try to check the meanings of the options(-zv) used in the examples in the article. There could be possible changes in the nc or ncat options and how they function, especially in RHEL/CentOS 7.3.

  2. Jonathan says:

    Very useful article for security. I’ll test that.Thank you !
    Long life to super penguin ^^

  3. Chris Pesoa says:

    Hello.

    In CentOS 7, there is no package named ‘nc‘.
    Searching for ‘netcat‘:

    $ yum search netcat
    

    the resulting package is ‘nmap-ncat.x86_64 : Nmap’s Netcat replacement

    If you install this package, the above command will looks like this:

    $ nc --recv-only -z 192.168.1.15 22
    

    There is another package ‘netcat-gnu‘. You can read more about this package in: https://fedora.pkgs.org/25/rpm-sphere/netcat-gnu-0.7.1-15.1.x86_64.rpm.html

    Are this observations correct?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *