shuf

shuf is a command-line utility included in the textutils package of GNU Core Utilities for creating a standard output consisting of random permutations of the input.

shuf
Operating systemUnix and Unix-like
TypeCommand
Licensecoreutils: GNU GPL v3

The version of shuf bundled in GNU coreutils was written by Paul Eggert. It is not a part of POSIX.[1]

Example

$ ls
Wikibooks  Wikipedia  Wiktionary
$ # Shuffles input 
$ ls | shuf 
Wikipedia
Wiktionary
Wikibooks
$ # Picks one random line from input
$ ls | shuf -n1
Wikipedia
gollark: Someone offered three prizekins. How do they get these things?
gollark: ```Wants: H: low-time Shimmer W: Free! Any 1 cb hatchling/non-messy red or purple hatchling=Auto!```Ah, very free right there!
gollark: Throw in some cheese and onion crisps and it's a deal.
gollark: Hmm... got offers of a CB silver and CB copper, random hatchlings (CB, probably), and an ER CB copper...
gollark: I've got a bunch with 10-20 minutes to go (3) so they're staying unfogged but ready to be viewed now.

See also

References

  1. shuf(1)  Linux General Commands Manual
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.