Today I Learned

hashrocket A Hashrocket project

Random Sort Text

You can sort to sort text in a file or STDIN. But what if you want to embrace the chaos and sort randomly? Turns out, there's a few ways to do that.

  • sort -R file.txt - sort's -R option does a random sort rather than lexicographically. The caveat here is if you have duplicates, they will be grouped together in the resulting output.
  • shuf file.txt - shuf is a standalone utility to generate random permutations.

Read their man pages to learn more!

See More #command-line TILs