Skip to content

Instantly share code, notes, and snippets.

@mizanRahman
Last active September 15, 2018 21:00
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 mizanRahman/e0c037d8b3c9d56e03e86d484cbc89ef to your computer and use it in GitHub Desktop.
Save mizanRahman/e0c037d8b3c9d56e03e86d484cbc89ef to your computer and use it in GitHub Desktop.
one liner scripts

kill process by port. can be defined as an alias

lsof -i :8080 | awk '{l=$2} END {print l}' | xargs kill

Output an arbitrary number of open TCP or UDP ports in an arbitrary range

comm -23 <(seq "$FROM" "$TO") <(ss -tan | awk '{print $4}' | cut -d':' -f2 | grep "[0-9]\{1,5\}" | sort | uniq) | shuf | head -n "$HOWMANY"
@mizanRahman
Copy link
Author

it also kills the process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment