Questions tagged «port»

5
如何仅获取端口3000上运行的进程的PID,而没有任何其他信息?
我正在使用CentOS7。我想获取在端口3000上运行的进程的PID(如果存在)。我想要获取此PID的目的是将其保存到Shell脚本中的变量中。到目前为止,我有 [rails@server proddir]$ sudo ss -lptn 'sport = :3000' State Recv-Q Send-Q Local Address:Port Peer Address:Port Cannot open netlink socket: Protocol not supported LISTEN 0 0 *:3000 *:* users:(("ruby",pid=4861,fd=7),("ruby",pid=4857,fd=7),("ruby",pid=4855,fd=7),("ruby",pid=4851,fd=7),("ruby",pid=4843,fd=7)) 但是我无法弄清楚如何在没有所有这些额外信息的情况下单独隔离PID。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.