如果你有权限操作:
ss netstat lsof fuser nmap
如果没有权限的话:
nmap nc ssh telnet
nmap -sV -p 22 192.168.1.1
# nmap -sS -p 8080 localhost Starting Nmap 6.40 ( http://nmap.org ) at 2020-03-24 04:14 EDT Nmap scan report for localhost (127.0.0.1) Host is up (0.00016s latency). Other addresses for localhost (not scanned): 127.0.0.1 PORT STATE SERVICE 8080/tcp open http-proxy Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
nc -v -w 1 10.4.7.100 3306
# nc -v -w 1 10.4.7.100 3306 Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to 10.4.7.100:3306. J 5.7.27螆35ÿ냿Vkd'}e}mysql_native_password
# nc -v -w 1 10.4.7.100 8080
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 10.4.7.100:8080.
^C
#端口不存活会直接拒绝
[root@localhost ~]# nc -v -w 1 10.4.7.100 8090
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection refused.
ssh -v -p 8080 root@localhost
# ssh -v -p 8080 root@localhost OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 58: Applying options for * debug1: Connecting to localhost [::1] port 8080. debug1: connect to address ::1 port 8080: Connection refused debug1: Connecting to localhost [127.0.0.1] port 8080. debug1: Connection established.