How to Use Netcat to Quickly Transfer Files between Linux Computers
Netcat, also known as “nc”, is a powerful tool that can be used for a variety of tasks in the Linux operating system. One of the most common uses of Netcat is for file transfer between two Linux computers.
This article will show you how to use Netcat to quickly and easily transfer files between two Linux computers.
Step 1: Install Netcat
If you don’t already have Netcat installed on your Linux computer, you can install it using the following command:
“`
sudo apt-get install netcat
“`
This command will install Netcat on your computer and make it available for use.
Step 2: Start a Listener
On the computer that you want to receive the files, start a Netcat listener. You can do this by running the following command:
“`
nc -l -p 1234 > received_file
“`
This command starts a Netcat listener on port 1234 and redirects the output to a file called “received_file”. This listener will wait for incoming data.
Step 3: Send the File
On the computer that has the file you want to transfer, run the following command:
“`
nc -w 3 1234
“`
Replace “ with the name of the file you want to transfer, and “ with the IP address of the computer that is receiving the file. The port number should match the one specified in the listener command from Step 2.
This command sends the file to the Netcat listener on the other computer.
Step 4: Verify the File Transfer
Once the transfer is complete, go to the computer that was receiving the file and check that the file was received and is intact.
Conclusion
Using Netcat for file transfer between Linux computers is an easy and efficient way to move files quickly. With these simple steps, you can use Netcat to transfer files between computers on your network with ease.