To send files using Netcat, follow these steps:
On the Receiving End (Listener)
-
Open a Terminal: Launch your terminal application.
-
Set Up the Listener: Run the following command to listen for incoming file transfers:
nc -l 12345 > received_file.txt- This command listens on port
12345and redirects the incoming data toreceived_file.txt.
- This command listens on port
On the Sending End (Sender)
-
Open Another Terminal: Launch a new terminal window.
-
Send the File: Use the following command to send a file:
nc localhost 12345 < file_to_send.txt- Replace
file_to_send.txtwith the path to the file you want to send.
- Replace
Complete the Transfer
- After executing the send command, the file will be transferred to the listener's terminal, and you will see it saved as
received_file.txt.
If you have any further questions or need clarification, feel free to ask!
