linux operation and maintenance tool nc

Netcat tool is called tcp / ip is best to use, but also the development of essential skills linux / operation and maintenance personnel;

1. Install nc

yum install nc -y

2. Common Functions

2.1 port test

Check whether to open a port server

IP Port -vz NC
NC 80 -vz 192.168.1.1
-v: display multiple point information
-z: no data is transmitted

E.g:
linux operation and maintenance tool nc

Port scanning range

nc -v -v -w3 -z 192.168.1.1 80-88
twice -v show more details;
-w3: set the scanning timeout time of 3 seconds;

2.2 transmission test

192.168.1.1 nc -l -p 8080 # listen 8080 port
192.168.1.2 nc 192.168.1.1 8080
so both sides of the conversation can be understood as a remote chat

UDP session

192.168.1.1 nc -u -l -p 8080 # listen 8080 port
192.168.1.2 nc -u 192.168.1.1 8080

2.3 File Transfer

Host A Host B want to transfer files how to do?

192.168.1.1 nc -l -p 8080> aa.zip # 8080 listening port
192.168.1.2 nc 192.168.1.1 8080 <aa.zip # AA.zip be sent to the specified host and port

2.4 Network speed test

192.168.1.1 nc -l -p 8080 | pv
192.168.1.2 nc 192.168.1.2 8080 < /dev/zero

2.5 Remote Control

A remote operation host Host B

NC -l -p 8080 -e 192.168.1.1 / bin / the bash
192.168.1.2 192.168.1.1 NC 8080
Host B can operate the host A

Guess you like

Origin blog.51cto.com/13733462/2484897
Recommended