Skip to content

Instantly share code, notes, and snippets.

@HouLinwei
Created June 28, 2017 01:45
Show Gist options
  • Save HouLinwei/0e27e816d4f2b48a720c59cececf4566 to your computer and use it in GitHub Desktop.
Save HouLinwei/0e27e816d4f2b48a720c59cececf4566 to your computer and use it in GitHub Desktop.
echo_pid_accodring_port
port=$1
pid=`netstat -nlp 2>/dev/null|grep ${port}|grep LISTEN|awk '{print \$NF}'|awk -F"/" '{print \$1}'`
echo $pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment