How to Install and Use Netcat in Termux

If you're using Termux and want to perform networking tasks like port scanning or creating simple chat tools, then Netcat is a must-have tool. In this guide, I will show you how to install and use Netcat in Termux step by step. Even if you're new to Termux, don't worry I’ll make everything clear and easy. Netcat in Termux What is Netcat? Netcat, also known as nc, is a powerful networking tool that can read and write data through network connections. It's often used by ethical hackers and system administrators for tasks like: Port scanning Creating reverse shells Transferring files Simple chatting between two devices It’s lightweight and comes in handy when working on networks using Termux on Android. Step 1: Update Termux Packages Before installing anything, always update your Termux packages to avoid errors. Open Termux and run: pkg update && pkg upgrade -y This will update all installed packages to their latest versions. Step 2: Install Netcat in Termux Now let’s install Netcat using the Termux package manager. Just type this command: pkg install netcat-openbsd -y This command will install Netcat in a few seconds. The -y option means "yes" to all prompts. Step 3: Check if Netcat is Installed After installation, check if Netcat is working properly by typing: nc If it's installed, you’ll see the Netcat options printed on your screen. If not, try restarting Termux or repeat the installation step. How to Use Netcat in Termux Here are some simple examples to help you understand how Netcat works. 1. Start a Listener To make your device listen on a port (like opening a server), run: nc -l -p 1234 This command opens port 1234 and waits for incoming connections. 2. Connect to the Listener From another device (or the same device in a new session), connect using: nc 127.0.0.1 1234 Now you can type messages between the two sessions. Whatever you type on one side will appear on the other side like a basic chat tool! 3. File Transfer using Netcat You can also use Netcat to send and receive files between devices. On the receiving side (listener): nc -l -p 4444 > received.txt On the sending side (sender): nc IP_ADDRESS 4444 < file.txt Replace IP_ADDRESS with the receiver’s IP and file.txt with the file you want to send. Why Use Netcat in Termux? Netcat is one of those small but powerful tools that can help you learn networking, ethical hacking, and penetration testing. With Termux on Android, you don’t even need a PC to try these things. Just follow basic security rules and use it for learning and testing your own networks. Final Words Now you know how to install Netcat in Termux and use it for basic networking tasks. If you're just getting started in cybersecurity or ethical hacking, Netcat is a great tool to explore. Keep practicing and stay ethical! Originally published at TerminalTools

Apr 28, 2025 - 09:15
 0
How to Install and Use Netcat in Termux

If you're using Termux and want to perform networking tasks like port scanning or creating simple chat tools, then Netcat is a must-have tool. In this guide, I will show you how to install and use Netcat in Termux step by step. Even if you're new to Termux, don't worry I’ll make everything clear and easy.

Illustration showing 'Netcat in Termux' with a networking icon and TerminalTools branding, designed for a tutorial or blog post about Netcat installation in Termux.
Netcat in Termux

What is Netcat?

Netcat, also known as nc, is a powerful networking tool that can read and write data through network connections. It's often used by ethical hackers and system administrators for tasks like:

  • Port scanning
  • Creating reverse shells
  • Transferring files
  • Simple chatting between two devices

It’s lightweight and comes in handy when working on networks using Termux on Android.

Step 1: Update Termux Packages

Before installing anything, always update your Termux packages to avoid errors. Open Termux and run:

pkg update && pkg upgrade -y

This will update all installed packages to their latest versions.

Step 2: Install Netcat in Termux

Now let’s install Netcat using the Termux package manager. Just type this command:

pkg install netcat-openbsd -y

This command will install Netcat in a few seconds. The -y option means "yes" to all prompts.

Step 3: Check if Netcat is Installed

After installation, check if Netcat is working properly by typing:

nc

If it's installed, you’ll see the Netcat options printed on your screen. If not, try restarting Termux or repeat the installation step.

How to Use Netcat in Termux

Here are some simple examples to help you understand how Netcat works.

1. Start a Listener

To make your device listen on a port (like opening a server), run:

nc -l -p 1234

This command opens port 1234 and waits for incoming connections.

2. Connect to the Listener

From another device (or the same device in a new session), connect using:

nc 127.0.0.1 1234

Now you can type messages between the two sessions. Whatever you type on one side will appear on the other side like a basic chat tool!

3. File Transfer using Netcat

You can also use Netcat to send and receive files between devices. On the receiving side (listener):

nc -l -p 4444 > received.txt

On the sending side (sender):

nc IP_ADDRESS 4444 < file.txt

Replace IP_ADDRESS with the receiver’s IP and file.txt with the file you want to send.

Why Use Netcat in Termux?

Netcat is one of those small but powerful tools that can help you learn networking, ethical hacking, and penetration testing. With Termux on Android, you don’t even need a PC to try these things. Just follow basic security rules and use it for learning and testing your own networks.

Final Words

Now you know how to install Netcat in Termux and use it for basic networking tasks. If you're just getting started in cybersecurity or ethical hacking, Netcat is a great tool to explore. Keep practicing and stay ethical!

Originally published at TerminalTools