Closed Captioning Closed captioning available on our YouTube channel

How to use the shuf command: 2-Minute Linux Tips

Network World | Aug 6, 2021

In this Linux tip, learn how to use the shuf command -- short for “shuffle”. It randomly rearranges lines from a file or output that is sent to it.

Copyright © 2021 IDG Communications, Inc.

Similar
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the shuf command -- short for “shuffle”. It randomly rearranges lines from a file or output that is sent to it. For example, if you wanted to rearrange the contents of a file every time you looked at it, you could do this:
Notice how every time we do this, the colors are in a different order. To sort the output from a command, do something like this:
The output should be fairly random, especially if the file that you’re shuffling is fairly long.
That’s your Linux tip for the shuf command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.
Popular
Featured videos from IDG.tv