How to know which flavor of netcat I'm using?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












There are two flavors of netcat: netcat-openbsd and netcat-traditional.



How to know which flavor of netcat I'm using? I've tried man nc but it doesn't say what flavor it is.







share|improve this question
























    up vote
    3
    down vote

    favorite












    There are two flavors of netcat: netcat-openbsd and netcat-traditional.



    How to know which flavor of netcat I'm using? I've tried man nc but it doesn't say what flavor it is.







    share|improve this question






















      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      There are two flavors of netcat: netcat-openbsd and netcat-traditional.



      How to know which flavor of netcat I'm using? I've tried man nc but it doesn't say what flavor it is.







      share|improve this question












      There are two flavors of netcat: netcat-openbsd and netcat-traditional.



      How to know which flavor of netcat I'm using? I've tried man nc but it doesn't say what flavor it is.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 28 '17 at 17:38









      user263210

      211




      211




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          7
          down vote













          First of all, you can install multiple flavors in your machine. So the answer depends on how many flavors you've installed and what command you type.



          netcat-traditional and netcat-openbsd is available to be install via package manager apt in Ubuntu. In my case I also build from source to install GNU netcat flavor via this official website.



          For "openbsd" flavor, you can figure out location binary name with dpkg -L <package-name> (Googling yourself to find equivalent of dpkg L if yor package manager is not apt):



          $ dpkg -L netcat-openbsd | grep /bin
          /bin
          /bin/nc.openbsd


          Then use type -a to confirm that binary name nc.openbsd is searchable in $PATH and interpreted as command:



          $ type -a nc.openbsd
          nc.openbsd is /bin/nc.openbsd
          nc.openbsd is /bin/nc.openbsd


          For "traditional" flavor is same:



          $ dpkg -L netcat-traditional | grep /bin
          /bin
          /bin/nc.traditional
          $ type -a nc.traditional
          nc.traditional is /bin/nc.traditional
          nc.traditional is /bin/nc.traditional


          That's means I can issue command nc.openbsd to run netcat-openbsd tool, and also command nc.traditional to run netcat-traditional tool. (There may confuse where the command contains '.' but package name contains '-' )



          Seems like there are 3 flavors to install via apt:



          $ apt-cache search netcat --names-only
          netcat-openbsd - TCP/IP swiss army knife
          netcat - TCP/IP swiss army knife -- transitional package
          netcat-traditional - TCP/IP swiss army knife


          But actually netcat is dummy package only:



          $ apt-cache show netcat | grep Description-en -A 2
          Description-en: TCP/IP swiss army knife -- transitional package
          This is a "dummy" package that depends on lenny's default version of
          netcat, to ease upgrades. It may be safely removed.


          So you can only install netcat-openbsd and netcat-traditional via apt if you want:



          sudo apt-get install netcat-openbsd
          sudo apt-get install netcat-traditional


          How about commands nc and netcat ? They can tied to multiple flavors searchable by $PATH, one of the path will run if you type nc or netcat. Again, you can use type -a to check, whereas priority is the first line (as bold below):



          $ type -a nc 
          nc is /usr/local/bin/nc
          nc is /bin/nc
          nc is /usr/local/bin/nc
          nc is /bin/nc
          $ type -a netcat
          netcat is /usr/local/bin/netcat
          netcat is /bin/netcat
          netcat is /usr/local/bin/netcat
          netcat is /bin/netcat


          You can use realpath to figure out resolved path of them:



          $ realpath /usr/local/bin/netcat 
          /usr/local/bin/netcat
          $ realpath /bin/netcat
          /bin/nc.openbsd
          $ realpath /usr/local/bin/nc
          /usr/local/bin/netcat
          $ realpath /bin/nc
          /bin/nc.openbsd


          4 of them only 2 paths is unique in my system, one is "GNU", and the other one is "openbsd":



          $ /usr/local/bin/netcat --version | head -1
          netcat (The GNU Netcat) 0.7.1
          $ /bin/nc.openbsd -h |& head -1
          OpenBSD netcat (Debian patchlevel 1.130-3)


          That's means if I type nc OR netcat, it will execute /usr/local/bin/netcat which is "GNU Netcat".



          You can try update-alternatives to adjust the resolved symlink path:



          $ realpath /bin/nc
          /bin/nc.openbsd
          $ realpath /bin/netcat
          /bin/nc.openbsd
          $ sudo update-alternatives --config nc
          There are 2 choices for the alternative nc (providing /bin/nc).

          Selection Path Priority Status
          ------------------------------------------------------------
          0 /bin/nc.openbsd 50 auto mode
          * 1 /bin/nc.openbsd 50 manual mode
          2 /bin/nc.traditional 10 manual mode

          Press <enter> to keep the current choice[*], or type selection number: 2
          update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in manual mode
          $ realpath /bin/nc
          /bin/nc.traditional
          $ realpath /bin/netcat
          /bin/nc.traditional


          It changed both /bin/nc and /bin/netcat resolved symlink¹ to /bin/nc.traditional, but still it doesn't changed the flavor if I type nc OR netcat since /usr/local/bin/ still has higher precedence over /bin in my $PATH:



          $ /bin/nc -h |& head -1
          [v1.10-41]
          $ nc -h |& head -1
          GNU netcat 0.7.1, a rewrite of the famous networking tool.
          $ type -a nc | head -1
          nc is /usr/local/bin/nc


          Note that there are more flavors of netcat, e.g. ncat, socat, sbd, netcat6, pnetcat, and cryptcat.



          ¹ The actual symlink updated were /etc/alternatives/nc and /etc/alternatives/netcat, which /bin/nc and /bin/netcat were already symlink to /etc/alternatives/nc and /etc/alternatives/netcat respectively.






          share|improve this answer





























            up vote
            1
            down vote













            When I run nc --version, I get:



            netcat (The GNU Netcat) 0.7.1
            Copyright (C) 2002 - 2003 Giovanni Giacobbi

            This program comes with NO WARRANTY, to the extent permitted by law.
            You may redistribute copies of this program under the terms of
            the GNU General Public License.
            For more information about these matters, see the file named COPYING.

            Original idea and design by Avian Research <hobbit@avian.org>,
            Written by Giovanni Giacobbi <giovanni@giacobbi.net>.


            Maybe the BSD version will say specifically as well.






            share|improve this answer




















            • Referencing another answer, what do you get for nc -h?
              – roaima
              Nov 30 '17 at 7:57










            • GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
              – John Moon
              Nov 30 '17 at 8:54










            • That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
              – roaima
              Nov 30 '17 at 11:09

















            up vote
            1
            down vote













            On a Mac (though it presents itself as the GNU version):



            $ nc -h
            GNU netcat 0.7.1, a rewrite of the famous networking tool.
            [ further output snipped ]


            On a Linux box (specifically Ubuntu):



            $ nc -h
            [v1.10-41]
            [ further output snipped ]


            netcat --version, suggested in another answer, threw an 'invalid option' error to --version, so -h seems to potentially be a universal test.






            share|improve this answer




















            • Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
              – Joseph
              Nov 30 '17 at 21:59










            • I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
              – DopeGhoti
              Nov 30 '17 at 22:12










            • One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
              – Joseph
              Nov 30 '17 at 22:18










            • On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
              – John Moon
              Dec 1 '17 at 0:56










            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407547%2fhow-to-know-which-flavor-of-netcat-im-using%23new-answer', 'question_page');

            );

            Post as a guest






























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            7
            down vote













            First of all, you can install multiple flavors in your machine. So the answer depends on how many flavors you've installed and what command you type.



            netcat-traditional and netcat-openbsd is available to be install via package manager apt in Ubuntu. In my case I also build from source to install GNU netcat flavor via this official website.



            For "openbsd" flavor, you can figure out location binary name with dpkg -L <package-name> (Googling yourself to find equivalent of dpkg L if yor package manager is not apt):



            $ dpkg -L netcat-openbsd | grep /bin
            /bin
            /bin/nc.openbsd


            Then use type -a to confirm that binary name nc.openbsd is searchable in $PATH and interpreted as command:



            $ type -a nc.openbsd
            nc.openbsd is /bin/nc.openbsd
            nc.openbsd is /bin/nc.openbsd


            For "traditional" flavor is same:



            $ dpkg -L netcat-traditional | grep /bin
            /bin
            /bin/nc.traditional
            $ type -a nc.traditional
            nc.traditional is /bin/nc.traditional
            nc.traditional is /bin/nc.traditional


            That's means I can issue command nc.openbsd to run netcat-openbsd tool, and also command nc.traditional to run netcat-traditional tool. (There may confuse where the command contains '.' but package name contains '-' )



            Seems like there are 3 flavors to install via apt:



            $ apt-cache search netcat --names-only
            netcat-openbsd - TCP/IP swiss army knife
            netcat - TCP/IP swiss army knife -- transitional package
            netcat-traditional - TCP/IP swiss army knife


            But actually netcat is dummy package only:



            $ apt-cache show netcat | grep Description-en -A 2
            Description-en: TCP/IP swiss army knife -- transitional package
            This is a "dummy" package that depends on lenny's default version of
            netcat, to ease upgrades. It may be safely removed.


            So you can only install netcat-openbsd and netcat-traditional via apt if you want:



            sudo apt-get install netcat-openbsd
            sudo apt-get install netcat-traditional


            How about commands nc and netcat ? They can tied to multiple flavors searchable by $PATH, one of the path will run if you type nc or netcat. Again, you can use type -a to check, whereas priority is the first line (as bold below):



            $ type -a nc 
            nc is /usr/local/bin/nc
            nc is /bin/nc
            nc is /usr/local/bin/nc
            nc is /bin/nc
            $ type -a netcat
            netcat is /usr/local/bin/netcat
            netcat is /bin/netcat
            netcat is /usr/local/bin/netcat
            netcat is /bin/netcat


            You can use realpath to figure out resolved path of them:



            $ realpath /usr/local/bin/netcat 
            /usr/local/bin/netcat
            $ realpath /bin/netcat
            /bin/nc.openbsd
            $ realpath /usr/local/bin/nc
            /usr/local/bin/netcat
            $ realpath /bin/nc
            /bin/nc.openbsd


            4 of them only 2 paths is unique in my system, one is "GNU", and the other one is "openbsd":



            $ /usr/local/bin/netcat --version | head -1
            netcat (The GNU Netcat) 0.7.1
            $ /bin/nc.openbsd -h |& head -1
            OpenBSD netcat (Debian patchlevel 1.130-3)


            That's means if I type nc OR netcat, it will execute /usr/local/bin/netcat which is "GNU Netcat".



            You can try update-alternatives to adjust the resolved symlink path:



            $ realpath /bin/nc
            /bin/nc.openbsd
            $ realpath /bin/netcat
            /bin/nc.openbsd
            $ sudo update-alternatives --config nc
            There are 2 choices for the alternative nc (providing /bin/nc).

            Selection Path Priority Status
            ------------------------------------------------------------
            0 /bin/nc.openbsd 50 auto mode
            * 1 /bin/nc.openbsd 50 manual mode
            2 /bin/nc.traditional 10 manual mode

            Press <enter> to keep the current choice[*], or type selection number: 2
            update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in manual mode
            $ realpath /bin/nc
            /bin/nc.traditional
            $ realpath /bin/netcat
            /bin/nc.traditional


            It changed both /bin/nc and /bin/netcat resolved symlink¹ to /bin/nc.traditional, but still it doesn't changed the flavor if I type nc OR netcat since /usr/local/bin/ still has higher precedence over /bin in my $PATH:



            $ /bin/nc -h |& head -1
            [v1.10-41]
            $ nc -h |& head -1
            GNU netcat 0.7.1, a rewrite of the famous networking tool.
            $ type -a nc | head -1
            nc is /usr/local/bin/nc


            Note that there are more flavors of netcat, e.g. ncat, socat, sbd, netcat6, pnetcat, and cryptcat.



            ¹ The actual symlink updated were /etc/alternatives/nc and /etc/alternatives/netcat, which /bin/nc and /bin/netcat were already symlink to /etc/alternatives/nc and /etc/alternatives/netcat respectively.






            share|improve this answer


























              up vote
              7
              down vote













              First of all, you can install multiple flavors in your machine. So the answer depends on how many flavors you've installed and what command you type.



              netcat-traditional and netcat-openbsd is available to be install via package manager apt in Ubuntu. In my case I also build from source to install GNU netcat flavor via this official website.



              For "openbsd" flavor, you can figure out location binary name with dpkg -L <package-name> (Googling yourself to find equivalent of dpkg L if yor package manager is not apt):



              $ dpkg -L netcat-openbsd | grep /bin
              /bin
              /bin/nc.openbsd


              Then use type -a to confirm that binary name nc.openbsd is searchable in $PATH and interpreted as command:



              $ type -a nc.openbsd
              nc.openbsd is /bin/nc.openbsd
              nc.openbsd is /bin/nc.openbsd


              For "traditional" flavor is same:



              $ dpkg -L netcat-traditional | grep /bin
              /bin
              /bin/nc.traditional
              $ type -a nc.traditional
              nc.traditional is /bin/nc.traditional
              nc.traditional is /bin/nc.traditional


              That's means I can issue command nc.openbsd to run netcat-openbsd tool, and also command nc.traditional to run netcat-traditional tool. (There may confuse where the command contains '.' but package name contains '-' )



              Seems like there are 3 flavors to install via apt:



              $ apt-cache search netcat --names-only
              netcat-openbsd - TCP/IP swiss army knife
              netcat - TCP/IP swiss army knife -- transitional package
              netcat-traditional - TCP/IP swiss army knife


              But actually netcat is dummy package only:



              $ apt-cache show netcat | grep Description-en -A 2
              Description-en: TCP/IP swiss army knife -- transitional package
              This is a "dummy" package that depends on lenny's default version of
              netcat, to ease upgrades. It may be safely removed.


              So you can only install netcat-openbsd and netcat-traditional via apt if you want:



              sudo apt-get install netcat-openbsd
              sudo apt-get install netcat-traditional


              How about commands nc and netcat ? They can tied to multiple flavors searchable by $PATH, one of the path will run if you type nc or netcat. Again, you can use type -a to check, whereas priority is the first line (as bold below):



              $ type -a nc 
              nc is /usr/local/bin/nc
              nc is /bin/nc
              nc is /usr/local/bin/nc
              nc is /bin/nc
              $ type -a netcat
              netcat is /usr/local/bin/netcat
              netcat is /bin/netcat
              netcat is /usr/local/bin/netcat
              netcat is /bin/netcat


              You can use realpath to figure out resolved path of them:



              $ realpath /usr/local/bin/netcat 
              /usr/local/bin/netcat
              $ realpath /bin/netcat
              /bin/nc.openbsd
              $ realpath /usr/local/bin/nc
              /usr/local/bin/netcat
              $ realpath /bin/nc
              /bin/nc.openbsd


              4 of them only 2 paths is unique in my system, one is "GNU", and the other one is "openbsd":



              $ /usr/local/bin/netcat --version | head -1
              netcat (The GNU Netcat) 0.7.1
              $ /bin/nc.openbsd -h |& head -1
              OpenBSD netcat (Debian patchlevel 1.130-3)


              That's means if I type nc OR netcat, it will execute /usr/local/bin/netcat which is "GNU Netcat".



              You can try update-alternatives to adjust the resolved symlink path:



              $ realpath /bin/nc
              /bin/nc.openbsd
              $ realpath /bin/netcat
              /bin/nc.openbsd
              $ sudo update-alternatives --config nc
              There are 2 choices for the alternative nc (providing /bin/nc).

              Selection Path Priority Status
              ------------------------------------------------------------
              0 /bin/nc.openbsd 50 auto mode
              * 1 /bin/nc.openbsd 50 manual mode
              2 /bin/nc.traditional 10 manual mode

              Press <enter> to keep the current choice[*], or type selection number: 2
              update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in manual mode
              $ realpath /bin/nc
              /bin/nc.traditional
              $ realpath /bin/netcat
              /bin/nc.traditional


              It changed both /bin/nc and /bin/netcat resolved symlink¹ to /bin/nc.traditional, but still it doesn't changed the flavor if I type nc OR netcat since /usr/local/bin/ still has higher precedence over /bin in my $PATH:



              $ /bin/nc -h |& head -1
              [v1.10-41]
              $ nc -h |& head -1
              GNU netcat 0.7.1, a rewrite of the famous networking tool.
              $ type -a nc | head -1
              nc is /usr/local/bin/nc


              Note that there are more flavors of netcat, e.g. ncat, socat, sbd, netcat6, pnetcat, and cryptcat.



              ¹ The actual symlink updated were /etc/alternatives/nc and /etc/alternatives/netcat, which /bin/nc and /bin/netcat were already symlink to /etc/alternatives/nc and /etc/alternatives/netcat respectively.






              share|improve this answer
























                up vote
                7
                down vote










                up vote
                7
                down vote









                First of all, you can install multiple flavors in your machine. So the answer depends on how many flavors you've installed and what command you type.



                netcat-traditional and netcat-openbsd is available to be install via package manager apt in Ubuntu. In my case I also build from source to install GNU netcat flavor via this official website.



                For "openbsd" flavor, you can figure out location binary name with dpkg -L <package-name> (Googling yourself to find equivalent of dpkg L if yor package manager is not apt):



                $ dpkg -L netcat-openbsd | grep /bin
                /bin
                /bin/nc.openbsd


                Then use type -a to confirm that binary name nc.openbsd is searchable in $PATH and interpreted as command:



                $ type -a nc.openbsd
                nc.openbsd is /bin/nc.openbsd
                nc.openbsd is /bin/nc.openbsd


                For "traditional" flavor is same:



                $ dpkg -L netcat-traditional | grep /bin
                /bin
                /bin/nc.traditional
                $ type -a nc.traditional
                nc.traditional is /bin/nc.traditional
                nc.traditional is /bin/nc.traditional


                That's means I can issue command nc.openbsd to run netcat-openbsd tool, and also command nc.traditional to run netcat-traditional tool. (There may confuse where the command contains '.' but package name contains '-' )



                Seems like there are 3 flavors to install via apt:



                $ apt-cache search netcat --names-only
                netcat-openbsd - TCP/IP swiss army knife
                netcat - TCP/IP swiss army knife -- transitional package
                netcat-traditional - TCP/IP swiss army knife


                But actually netcat is dummy package only:



                $ apt-cache show netcat | grep Description-en -A 2
                Description-en: TCP/IP swiss army knife -- transitional package
                This is a "dummy" package that depends on lenny's default version of
                netcat, to ease upgrades. It may be safely removed.


                So you can only install netcat-openbsd and netcat-traditional via apt if you want:



                sudo apt-get install netcat-openbsd
                sudo apt-get install netcat-traditional


                How about commands nc and netcat ? They can tied to multiple flavors searchable by $PATH, one of the path will run if you type nc or netcat. Again, you can use type -a to check, whereas priority is the first line (as bold below):



                $ type -a nc 
                nc is /usr/local/bin/nc
                nc is /bin/nc
                nc is /usr/local/bin/nc
                nc is /bin/nc
                $ type -a netcat
                netcat is /usr/local/bin/netcat
                netcat is /bin/netcat
                netcat is /usr/local/bin/netcat
                netcat is /bin/netcat


                You can use realpath to figure out resolved path of them:



                $ realpath /usr/local/bin/netcat 
                /usr/local/bin/netcat
                $ realpath /bin/netcat
                /bin/nc.openbsd
                $ realpath /usr/local/bin/nc
                /usr/local/bin/netcat
                $ realpath /bin/nc
                /bin/nc.openbsd


                4 of them only 2 paths is unique in my system, one is "GNU", and the other one is "openbsd":



                $ /usr/local/bin/netcat --version | head -1
                netcat (The GNU Netcat) 0.7.1
                $ /bin/nc.openbsd -h |& head -1
                OpenBSD netcat (Debian patchlevel 1.130-3)


                That's means if I type nc OR netcat, it will execute /usr/local/bin/netcat which is "GNU Netcat".



                You can try update-alternatives to adjust the resolved symlink path:



                $ realpath /bin/nc
                /bin/nc.openbsd
                $ realpath /bin/netcat
                /bin/nc.openbsd
                $ sudo update-alternatives --config nc
                There are 2 choices for the alternative nc (providing /bin/nc).

                Selection Path Priority Status
                ------------------------------------------------------------
                0 /bin/nc.openbsd 50 auto mode
                * 1 /bin/nc.openbsd 50 manual mode
                2 /bin/nc.traditional 10 manual mode

                Press <enter> to keep the current choice[*], or type selection number: 2
                update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in manual mode
                $ realpath /bin/nc
                /bin/nc.traditional
                $ realpath /bin/netcat
                /bin/nc.traditional


                It changed both /bin/nc and /bin/netcat resolved symlink¹ to /bin/nc.traditional, but still it doesn't changed the flavor if I type nc OR netcat since /usr/local/bin/ still has higher precedence over /bin in my $PATH:



                $ /bin/nc -h |& head -1
                [v1.10-41]
                $ nc -h |& head -1
                GNU netcat 0.7.1, a rewrite of the famous networking tool.
                $ type -a nc | head -1
                nc is /usr/local/bin/nc


                Note that there are more flavors of netcat, e.g. ncat, socat, sbd, netcat6, pnetcat, and cryptcat.



                ¹ The actual symlink updated were /etc/alternatives/nc and /etc/alternatives/netcat, which /bin/nc and /bin/netcat were already symlink to /etc/alternatives/nc and /etc/alternatives/netcat respectively.






                share|improve this answer














                First of all, you can install multiple flavors in your machine. So the answer depends on how many flavors you've installed and what command you type.



                netcat-traditional and netcat-openbsd is available to be install via package manager apt in Ubuntu. In my case I also build from source to install GNU netcat flavor via this official website.



                For "openbsd" flavor, you can figure out location binary name with dpkg -L <package-name> (Googling yourself to find equivalent of dpkg L if yor package manager is not apt):



                $ dpkg -L netcat-openbsd | grep /bin
                /bin
                /bin/nc.openbsd


                Then use type -a to confirm that binary name nc.openbsd is searchable in $PATH and interpreted as command:



                $ type -a nc.openbsd
                nc.openbsd is /bin/nc.openbsd
                nc.openbsd is /bin/nc.openbsd


                For "traditional" flavor is same:



                $ dpkg -L netcat-traditional | grep /bin
                /bin
                /bin/nc.traditional
                $ type -a nc.traditional
                nc.traditional is /bin/nc.traditional
                nc.traditional is /bin/nc.traditional


                That's means I can issue command nc.openbsd to run netcat-openbsd tool, and also command nc.traditional to run netcat-traditional tool. (There may confuse where the command contains '.' but package name contains '-' )



                Seems like there are 3 flavors to install via apt:



                $ apt-cache search netcat --names-only
                netcat-openbsd - TCP/IP swiss army knife
                netcat - TCP/IP swiss army knife -- transitional package
                netcat-traditional - TCP/IP swiss army knife


                But actually netcat is dummy package only:



                $ apt-cache show netcat | grep Description-en -A 2
                Description-en: TCP/IP swiss army knife -- transitional package
                This is a "dummy" package that depends on lenny's default version of
                netcat, to ease upgrades. It may be safely removed.


                So you can only install netcat-openbsd and netcat-traditional via apt if you want:



                sudo apt-get install netcat-openbsd
                sudo apt-get install netcat-traditional


                How about commands nc and netcat ? They can tied to multiple flavors searchable by $PATH, one of the path will run if you type nc or netcat. Again, you can use type -a to check, whereas priority is the first line (as bold below):



                $ type -a nc 
                nc is /usr/local/bin/nc
                nc is /bin/nc
                nc is /usr/local/bin/nc
                nc is /bin/nc
                $ type -a netcat
                netcat is /usr/local/bin/netcat
                netcat is /bin/netcat
                netcat is /usr/local/bin/netcat
                netcat is /bin/netcat


                You can use realpath to figure out resolved path of them:



                $ realpath /usr/local/bin/netcat 
                /usr/local/bin/netcat
                $ realpath /bin/netcat
                /bin/nc.openbsd
                $ realpath /usr/local/bin/nc
                /usr/local/bin/netcat
                $ realpath /bin/nc
                /bin/nc.openbsd


                4 of them only 2 paths is unique in my system, one is "GNU", and the other one is "openbsd":



                $ /usr/local/bin/netcat --version | head -1
                netcat (The GNU Netcat) 0.7.1
                $ /bin/nc.openbsd -h |& head -1
                OpenBSD netcat (Debian patchlevel 1.130-3)


                That's means if I type nc OR netcat, it will execute /usr/local/bin/netcat which is "GNU Netcat".



                You can try update-alternatives to adjust the resolved symlink path:



                $ realpath /bin/nc
                /bin/nc.openbsd
                $ realpath /bin/netcat
                /bin/nc.openbsd
                $ sudo update-alternatives --config nc
                There are 2 choices for the alternative nc (providing /bin/nc).

                Selection Path Priority Status
                ------------------------------------------------------------
                0 /bin/nc.openbsd 50 auto mode
                * 1 /bin/nc.openbsd 50 manual mode
                2 /bin/nc.traditional 10 manual mode

                Press <enter> to keep the current choice[*], or type selection number: 2
                update-alternatives: using /bin/nc.traditional to provide /bin/nc (nc) in manual mode
                $ realpath /bin/nc
                /bin/nc.traditional
                $ realpath /bin/netcat
                /bin/nc.traditional


                It changed both /bin/nc and /bin/netcat resolved symlink¹ to /bin/nc.traditional, but still it doesn't changed the flavor if I type nc OR netcat since /usr/local/bin/ still has higher precedence over /bin in my $PATH:



                $ /bin/nc -h |& head -1
                [v1.10-41]
                $ nc -h |& head -1
                GNU netcat 0.7.1, a rewrite of the famous networking tool.
                $ type -a nc | head -1
                nc is /usr/local/bin/nc


                Note that there are more flavors of netcat, e.g. ncat, socat, sbd, netcat6, pnetcat, and cryptcat.



                ¹ The actual symlink updated were /etc/alternatives/nc and /etc/alternatives/netcat, which /bin/nc and /bin/netcat were already symlink to /etc/alternatives/nc and /etc/alternatives/netcat respectively.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 2 '17 at 16:19

























                answered Nov 28 '17 at 20:13









                林果皞

                2,2131228




                2,2131228






















                    up vote
                    1
                    down vote













                    When I run nc --version, I get:



                    netcat (The GNU Netcat) 0.7.1
                    Copyright (C) 2002 - 2003 Giovanni Giacobbi

                    This program comes with NO WARRANTY, to the extent permitted by law.
                    You may redistribute copies of this program under the terms of
                    the GNU General Public License.
                    For more information about these matters, see the file named COPYING.

                    Original idea and design by Avian Research <hobbit@avian.org>,
                    Written by Giovanni Giacobbi <giovanni@giacobbi.net>.


                    Maybe the BSD version will say specifically as well.






                    share|improve this answer




















                    • Referencing another answer, what do you get for nc -h?
                      – roaima
                      Nov 30 '17 at 7:57










                    • GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
                      – John Moon
                      Nov 30 '17 at 8:54










                    • That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
                      – roaima
                      Nov 30 '17 at 11:09














                    up vote
                    1
                    down vote













                    When I run nc --version, I get:



                    netcat (The GNU Netcat) 0.7.1
                    Copyright (C) 2002 - 2003 Giovanni Giacobbi

                    This program comes with NO WARRANTY, to the extent permitted by law.
                    You may redistribute copies of this program under the terms of
                    the GNU General Public License.
                    For more information about these matters, see the file named COPYING.

                    Original idea and design by Avian Research <hobbit@avian.org>,
                    Written by Giovanni Giacobbi <giovanni@giacobbi.net>.


                    Maybe the BSD version will say specifically as well.






                    share|improve this answer




















                    • Referencing another answer, what do you get for nc -h?
                      – roaima
                      Nov 30 '17 at 7:57










                    • GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
                      – John Moon
                      Nov 30 '17 at 8:54










                    • That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
                      – roaima
                      Nov 30 '17 at 11:09












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    When I run nc --version, I get:



                    netcat (The GNU Netcat) 0.7.1
                    Copyright (C) 2002 - 2003 Giovanni Giacobbi

                    This program comes with NO WARRANTY, to the extent permitted by law.
                    You may redistribute copies of this program under the terms of
                    the GNU General Public License.
                    For more information about these matters, see the file named COPYING.

                    Original idea and design by Avian Research <hobbit@avian.org>,
                    Written by Giovanni Giacobbi <giovanni@giacobbi.net>.


                    Maybe the BSD version will say specifically as well.






                    share|improve this answer












                    When I run nc --version, I get:



                    netcat (The GNU Netcat) 0.7.1
                    Copyright (C) 2002 - 2003 Giovanni Giacobbi

                    This program comes with NO WARRANTY, to the extent permitted by law.
                    You may redistribute copies of this program under the terms of
                    the GNU General Public License.
                    For more information about these matters, see the file named COPYING.

                    Original idea and design by Avian Research <hobbit@avian.org>,
                    Written by Giovanni Giacobbi <giovanni@giacobbi.net>.


                    Maybe the BSD version will say specifically as well.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 28 '17 at 17:42









                    John Moon

                    49026




                    49026











                    • Referencing another answer, what do you get for nc -h?
                      – roaima
                      Nov 30 '17 at 7:57










                    • GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
                      – John Moon
                      Nov 30 '17 at 8:54










                    • That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
                      – roaima
                      Nov 30 '17 at 11:09
















                    • Referencing another answer, what do you get for nc -h?
                      – roaima
                      Nov 30 '17 at 7:57










                    • GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
                      – John Moon
                      Nov 30 '17 at 8:54










                    • That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
                      – roaima
                      Nov 30 '17 at 11:09















                    Referencing another answer, what do you get for nc -h?
                    – roaima
                    Nov 30 '17 at 7:57




                    Referencing another answer, what do you get for nc -h?
                    – roaima
                    Nov 30 '17 at 7:57












                    GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
                    – John Moon
                    Nov 30 '17 at 8:54




                    GNU netcat 0.7.1, a rewrite of the famous networking tool. followed by the help text.
                    – John Moon
                    Nov 30 '17 at 8:54












                    That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
                    – roaima
                    Nov 30 '17 at 11:09




                    That's interesting. It seems that nc -h works in "both" versions, whereas nc --version works only for the GNU implementation. Thanks.
                    – roaima
                    Nov 30 '17 at 11:09










                    up vote
                    1
                    down vote













                    On a Mac (though it presents itself as the GNU version):



                    $ nc -h
                    GNU netcat 0.7.1, a rewrite of the famous networking tool.
                    [ further output snipped ]


                    On a Linux box (specifically Ubuntu):



                    $ nc -h
                    [v1.10-41]
                    [ further output snipped ]


                    netcat --version, suggested in another answer, threw an 'invalid option' error to --version, so -h seems to potentially be a universal test.






                    share|improve this answer




















                    • Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
                      – Joseph
                      Nov 30 '17 at 21:59










                    • I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
                      – DopeGhoti
                      Nov 30 '17 at 22:12










                    • One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
                      – Joseph
                      Nov 30 '17 at 22:18










                    • On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
                      – John Moon
                      Dec 1 '17 at 0:56














                    up vote
                    1
                    down vote













                    On a Mac (though it presents itself as the GNU version):



                    $ nc -h
                    GNU netcat 0.7.1, a rewrite of the famous networking tool.
                    [ further output snipped ]


                    On a Linux box (specifically Ubuntu):



                    $ nc -h
                    [v1.10-41]
                    [ further output snipped ]


                    netcat --version, suggested in another answer, threw an 'invalid option' error to --version, so -h seems to potentially be a universal test.






                    share|improve this answer




















                    • Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
                      – Joseph
                      Nov 30 '17 at 21:59










                    • I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
                      – DopeGhoti
                      Nov 30 '17 at 22:12










                    • One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
                      – Joseph
                      Nov 30 '17 at 22:18










                    • On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
                      – John Moon
                      Dec 1 '17 at 0:56












                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    On a Mac (though it presents itself as the GNU version):



                    $ nc -h
                    GNU netcat 0.7.1, a rewrite of the famous networking tool.
                    [ further output snipped ]


                    On a Linux box (specifically Ubuntu):



                    $ nc -h
                    [v1.10-41]
                    [ further output snipped ]


                    netcat --version, suggested in another answer, threw an 'invalid option' error to --version, so -h seems to potentially be a universal test.






                    share|improve this answer












                    On a Mac (though it presents itself as the GNU version):



                    $ nc -h
                    GNU netcat 0.7.1, a rewrite of the famous networking tool.
                    [ further output snipped ]


                    On a Linux box (specifically Ubuntu):



                    $ nc -h
                    [v1.10-41]
                    [ further output snipped ]


                    netcat --version, suggested in another answer, threw an 'invalid option' error to --version, so -h seems to potentially be a universal test.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 28 '17 at 17:58









                    DopeGhoti

                    40.6k54979




                    40.6k54979











                    • Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
                      – Joseph
                      Nov 30 '17 at 21:59










                    • I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
                      – DopeGhoti
                      Nov 30 '17 at 22:12










                    • One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
                      – Joseph
                      Nov 30 '17 at 22:18










                    • On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
                      – John Moon
                      Dec 1 '17 at 0:56
















                    • Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
                      – Joseph
                      Nov 30 '17 at 21:59










                    • I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
                      – DopeGhoti
                      Nov 30 '17 at 22:12










                    • One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
                      – Joseph
                      Nov 30 '17 at 22:18










                    • On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
                      – John Moon
                      Dec 1 '17 at 0:56















                    Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
                    – Joseph
                    Nov 30 '17 at 21:59




                    Does GNU netcat comes pre-installed with mac OS or did you install it yourself?
                    – Joseph
                    Nov 30 '17 at 21:59












                    I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
                    – DopeGhoti
                    Nov 30 '17 at 22:12




                    I honestly do not recall, but the fact that it's in /usr/local/bin rather than /usr/bin implies I may have installed it with brew.
                    – DopeGhoti
                    Nov 30 '17 at 22:12












                    One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
                    – Joseph
                    Nov 30 '17 at 22:18




                    One last question if you don't mind, is the binary for GNU netcat called "netcat" and "nc" is just a link for "netcat"? (because I see here that the binary is called "netcat": fedora.pkgs.org/25/rpm-sphere/…).
                    – Joseph
                    Nov 30 '17 at 22:18












                    On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
                    – John Moon
                    Dec 1 '17 at 0:56




                    On my system, nc is just a symlink to netcat. You can check yourself with file $(which nc) which gives me /usr/bin/nc: symbolic link to netcat.
                    – John Moon
                    Dec 1 '17 at 0:56

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407547%2fhow-to-know-which-flavor-of-netcat-im-using%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?