Open In App

How to switch to netcat-traditional in Ubuntu?

Last Updated : 13 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Netcat or nc is one of the favorable network tools that functions in both the TCP/UDP connections. This tool is developed for powerful systems like Unix-based, Netcat also enables users to create connections between different computer nodes, transfer data na dalso establish various network-related functionalities. In Ubuntu, the default Netcat implementation is often provided by the OpenBSD version, commonly known as netcat-openbsd. However, users may prefer to switch to the traditional version of Netcat, denoted as netcat-traditional, so to switch we need to perform some steps. In this article, we will explore the steps to switch to netcat-traditional in Ubuntu.

Why switch to netcat-traditional in Ubuntu?

Below are some of the reasons states why to switch to netcat-traditional in Ubuntu:

  • Script Compatibility: Makes sure that scripts written for traditional Netcat work seamlessly without modification.
  • Standardized Features: Access consistent features and options across different Netcat implementations.
  • Familiar Syntax: Use a command-line interface with syntax and behavior more familiar to traditional Netcat users.
  • Cross-Platform Consistency: Enhance compatibility with Netcat implementations on various operating systems.
  • Personal Preference: Opt for the version that aligns with personal preferences and specific use cases.

How to switch to netcat-traditional in Ubuntu?

In this section, we will see the steps to switch to netcat-traditional in Ubuntu. So follow the below steps with proper command execution to avoid errors in switching:

Step 1: Open the Terminal

Firstly, we need to launch the terminal on our Linux system, we can launch by using the Application Menu or by using the Keyboard Shortcut as “CTRL + ALT + T“.

Opening the Terminal

Opening the Terminal

Step 2: Update the System

Once the terminal is been launched, we need to update the system repositories by executing the below command in the terminal. We can use the apt manager to update the system.

sudo apt update
Update the System

Update the System

Step 3: Install netcat-traditional

Once the system is been updated, we need to install the netcat-traditional package using the apt manager. Execute the below command in the terminal to install netcat-traditional.

sudo apt-get install netcat-tradtional
Install netcat-traditional

Install netcat-traditional

Step 4: Update Alternatives

After the successful installation of netcat-traditional, we need to update the alternatives by using the below command. We need to run the below command in the terminal.

sudo update-alternatives --config nc
Update Alternatives

Update Alternatives

Step 5: Select netcat-traditional

Once the update-alternatives command is been executed, we will see alternatives for the nc command. From this, we need to type the number correcting to the netcat-traditional version.

Select Option 2
Select netcat-traditional

Select netcat-traditional

Step 6: Verify the Switch

Once we have selected the appropriate switch alternative, we can verify the switch by checking the version of netcat-traditional. Run the below command in the terminal.

nc.traditional -h
Verify the Switch

Verify the Switch

Step 7: Create Symbolic Link

If we need to create a symbolic link so that nc always points to netcat-traditional, then we can run the below command. This step is completely optional.

sudo ln -sf /bin/nc.traditional /etc/alternatives/nc
Create Symbolic Link (Optional)

Create Symbolic Link (Optional)

Conclusion

In Ubuntu, switching to netcat-traditional involves using the update-alternatives command to select the desired alternative for the netcat utility. This allows users to opt for the traditional version of netcat, netcat-traditional, which can be crucial for compatibility or when specific features of the traditional implementation are needed. By running “sudo update-alternatives –config nc” in the terminal and choosing the appropriate alternative, users can seamlessly switch to netcat-traditional and tailor their network-related tasks according to their requirements.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads