sudo netstat -anp | grep -w 443 | grep ESTABLISHED | awk '{print $7}' | cut -d/ -f1 | while read line; do echo 'pid : '$line; done
如果只需要第一行
sudo netstat -anp | grep -w 443 | grep ESTABLISHED | awk 'NR==1{print $7}' | cut -d/ -f1
sudo netstat -anp | grep -w 443 | grep ESTABLISHED | awk '{print $7}' | cut -d/ -f1 | while read line; do echo 'pid : '$line; done
如果只需要第一行
sudo netstat -anp | grep -w 443 | grep ESTABLISHED | awk 'NR==1{print $7}' | cut -d/ -f1
转载于:https://www.cnblogs.com/xxxuwentao/p/10343563.html