Skip to content

Instantly share code, notes, and snippets.

@gargolito
Last active March 29, 2019 11:10
Show Gist options
  • Save gargolito/6926dcb73fea5bee9e73346749406350 to your computer and use it in GitHub Desktop.
Save gargolito/6926dcb73fea5bee9e73346749406350 to your computer and use it in GitHub Desktop.
#bash
# compare two directories
diff --brief --recursive --no-dereference --new-file --no-ignore-file-name-case /dir1 /dir2 > dirdiff_1.txt
rsync --recursive --delete --links --checksum --verbose --dry-run /dir1/ /dir2/ > dirdiff_2.txt
# Given a text file and an integer k, print the k most common words in the file (and the number of their occurrences) in decreasing frequency. https://www.johndcook.com/blog/2019/02/18/command-line-wizard/
cat stuff.txt | tr -cs A-Za-z '\n' | tr A-Z a-z | sort | uniq -c | sort -rn | sed ${1}q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment