Skip to content

Instantly share code, notes, and snippets.

@jacobtomlinson
Last active December 6, 2024 14:07
Show Gist options
  • Save jacobtomlinson/86ea8a25af541daa1d79aad6706cfae7 to your computer and use it in GitHub Desktop.
Save jacobtomlinson/86ea8a25af541daa1d79aad6706cfae7 to your computer and use it in GitHub Desktop.
Shell History Unwrapped
awk 'NR==FNR {map[$1]=$2; next} {print ($1 in map ? map[$1] : $1)}' <(alias | sed -E "s/^([^=]*)='?([^ ]*).*/\1 \2/") <(echo "SHELL HISTORY UNWRAPPED" `date +%Y` && history | gawk '{gsub(/^\s*[0-9]+\*?(\s*[0-9/T:]+)\s+/, "", $0); print $0}' | gawk '{gsub(/ \| /, "\n", $0); print $0}' | gawk ' { i=2; while ($1 ~ /^[A-Z0-9_]+=/) { $1=$i; i++ }; print $1 }') | sort | uniq -c | sort -n | tail -n 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment