Skip to content

Instantly share code, notes, and snippets.

@tjcelaya
Last active May 21, 2017 22:59
Show Gist options
  • Save tjcelaya/f0c7d2fe185cf622dfdaf9294bf43cf5 to your computer and use it in GitHub Desktop.
Save tjcelaya/f0c7d2fe185cf622dfdaf9294bf43cf5 to your computer and use it in GitHub Desktop.
shortcuts for the laziest of the lazy
function aq {
# provide the column number ($1) to awk, and optionally the column separator ($2)
local fs=$( [ $# -ge 2 ] && echo "-F'$2'")
eval awk "$fs" "'{print \$$1}'"
}
function port-clear {
# slaughter whatever process is on port number ($1)
netstat -plnt | grep ":$1" | awk '{ split($NF,pd,"/"); print pd[1] }' | xargs kill -9
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment