Here’s how to quickly transfer files from one Linux system to another using netcat:
1. Issue the following command in terminal on the source Linux system –
cat <file name> | nc -l <port number>
For example, to transfer a file ‘About.txt’ using port 5000, we need to issue the following command in terminal on the source Linux system –
cat About.txt | nc -l 5000
2. To receive the file on the target system, issue the following command at the terminal –
nc <source Linux system IP> <port number> > <file name>
For example, to receive the file ‘About.txt’ from step 1, we need to issue the following command on the target Linux system –
nc 192.168.148.128 5000 > About.txt
Since you can choose the port number, you can use this command to get around firewalls 😉