Skip to content

Instantly share code, notes, and snippets.

@saylestyler
Last active February 4, 2019 18:25
Show Gist options
  • Save saylestyler/0aa8a06da71e1996638e8565fd0dbbea to your computer and use it in GitHub Desktop.
Save saylestyler/0aa8a06da71e1996638e8565fd0dbbea to your computer and use it in GitHub Desktop.
shell tings
# get the 20 most used commands
# https://github.com/trimstray/the-book-of-secret-knowledge#tool-terminal
history | \
awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | \
grep -v "./" | \
column -c3 -s " " -t | \
sort -nr | nl | head -n 20
# kill process running on port <port>
kill -9 $(lsof -i :<port> | awk '{l=$2} END {print l}')
# find last reboot time
who -b
# show 20 biggest directories with K M G
du | \
sort -r -n | \
awk '{split("K M G",v); s=1; while($1>1024){$1/=1024; s++} print int($1)" "v[s]"\t"$2}' | \
head -n 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment