nc command to transfer files or folders between Linux servers

Sometimes, when uploading files or folders to an online server, without making a secret key or knowing the relevant password of the user, neither scp nor rsync can be used.

It is recommended to use the nc command to transfer between Linux servers, provided that they can ping each other.

Folder:
the server that accepts the file nc -l 9995 | tar zxvf - (you can get the local intranet ip-1.1.1.1 first, and then you need to copy it to another server, the port 9995 can be the same, you can feel free)
where the file is located server tar zcvf -filename/* | nc 1.1.1.1 9995

File:
receiver nc -l 1234 > abc.log ip is 1.1.1.1
sender nc -w 1000 1.1.1.1 1234 < abc.log

It's that simple, fast and convenient.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324801274&siteId=291194637