Skip to content

Instantly share code, notes, and snippets.

@wlangstroth
Created November 21, 2012 13:20
Show Gist options
  • Save wlangstroth/4124814 to your computer and use it in GitHub Desktop.
Save wlangstroth/4124814 to your computer and use it in GitHub Desktop.
Quora thread snippets
cat a b | sort | uniq > c # c is a union b
cat a b | sort | uniq -d > c # c is a intersect b
cat a b b | sort | uniq -u > c # c is set difference a - b
find . -type f -ls
find . -name \*.py | xargs grep some_function
cat hosts | xargs -I{} ssh root@{} hostname
cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn
ps aux | grep mypattern | awk '{ print $2}' | xargs kill
pkill -f mypattern
# Top ten running processes sorted by memory usage
ps aux | sort -nk +4 | tail
diff -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment