Skip to content

Instantly share code, notes, and snippets.

@DanielleSucher
Last active December 18, 2015 15:49
Show Gist options
  • Save DanielleSucher/5806898 to your computer and use it in GitHub Desktop.
Save DanielleSucher/5806898 to your computer and use it in GitHub Desktop.
One-liners
Replace all instances of old_string with new_string recursively within the current directory and its sub-directories:
grep -rl old_string * | xargs sed -i '' 's/old_string/new_string/g'
Sum all numbers in your file (assuming that the numbers are the first column, one per line):
awk '{s+=$1} END {print s}' $filename
List all ports a process is using:
lsof -a -pPID -i4 (or -i6)
List what process is using a port:
lsof -i :PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment