如果是debian,ubuntu这类以dpkg包管理的,用dpkg -l|grep gnutls
在Linux中查找服务的端口方法1:使用grep命令
要使用grep命令在Linux中查找指定服务的默认端口号,只需运行:
$grep<port>/etc/services
例如,要查找SSH服务的默认端口,只需运行:
$grep ssh/etc/services
就这么简单。此命令应该适用于大多数Linux发行版。以下是我的Arch Linux测试机中的示例输出:
ssh 22/tcp
ssh 22/udp
ssh 22/sctp
sshell 614/tcp
sshell 614/udp
netconf-ssh 830/tcp
netconf-ssh 830/udp
sdo-ssh 3897/tcp
sdo-ssh 3897/udp
netconf-ch-ssh 4334/tcp
snmpssh 5161/tcp
snmpssh-trap 5162/tcp
tl1-ssh 6252/tcp
tl1-ssh 6252/udp
ssh-mgmt 17235/tcp
ssh-mgmt 17235/udp
正如你在上面的输出中所看到的,SSH服务的默认端口号是22。
让我们找到Apache Web服务器的端口号。为此,命令是:
$grep http/etc/services
#http://www.iana.org/assignments/port-numbers
http 80/tcp www www-http#WorldWideWeb HTTP
http 80/udp www www-http#HyperText Transfer Protocol
http 80/sctp#HyperText Transfer Protocol
https 443/tcp#http protocol over TLS/SSL
https 443/udp#http protocol over TLS/SSL
https 443/sctp#http protocol over TLS/SSL
gss-http 488/tcp
gss-http 488/udp
webcache 8080/tcp http-alt#WWW caching service
webcache 8080/udp http-alt#WWW caching service
[...]
FTP端口号是什么?这很简单!
$grep ftp/etc/services
ftp-data 20/tcp
ftp-data 20/udp
#21 is registered to ftp,but also used by fsp
ftp 21/tcp
ftp 21/udp fsp fspd
tftp 69/tcp
[...]
方法2:使用getent命令
如你所见,上面的命令显示指定搜索词“ssh”、“http”和“ftp”的所有端口名称和数字。这意味着,你将获得与给定搜索词匹配的所有端口名称的相当长的输出。
但是,你可以使用getent命令精确输出结果,如下所示:
$getent services ssh
ssh 22/tcp
$getent services http
http 80/tcp www www-http
$getent services ftp
ftp 21/tcp
如果你不知道端口名称,但是知道端口号,那么你只需将端口名称替换为数字:
$getent services 80
http 80/tcp
要显示所有端口名称和端口号,只需运行:
$getent services
linux 访问 https 证书问题[root@boss-test-dev001-jydx ~]# curl -v https://mobile.mycard520.com.tw
* About to connect() to mobile.mycard520.com.tw port 443 (#0)
* Trying 220.130.127.122... connected
* Connected to mobile.mycard520.com.tw (220.130.127.122) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* Certificate is signed by an untrusted issuer: 'CN=TWCA Secure SSL Certification Authority,OU=Secure SSL Sub-CA,O=TAIWAN-CA,C=TW'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)