Amazing command of the day: shuf

Today I learned an amazing bash command: shuf. It shuffles the lines of an input file, and prints them to the standard output. This is super useful when you want to sample a few lines from a very large file, to have an idea of its contents. See the image below for details:

I learned about this command while I was playing with Google’s “Covid Mobility Dataset”. This is a dataset of day-to-day relative changes in visits to 5 different location categories (essential shopping, shopping, parks, transportation, workplaces), as measured in Google’s “Location History” dataset, for many cities across the world.

Originally someone suggested me this data for a research project I’m working on, involving training agents to reproduce mobility patterns from humans. After studying the data, I came to the conclusion that it will probably not be very useful for this particular project. However, this is still a fascinating dataset, and I’m sure a lot of cool things could be learned from it, if anyone took the time to look through it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.