Skip to content

Instantly share code, notes, and snippets.

@freshjones
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freshjones/315a65f0caf59178c969 to your computer and use it in GitHub Desktop.
Save freshjones/315a65f0caf59178c969 to your computer and use it in GitHub Desktop.
Output port number if its an active port, blank if its not
netstat -ln | grep LISTEN | grep -o ':<portnum> ' | awk {'print substr($0,2)'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment