shuf - Shuffle the input by outputting a random permutation of input lines. Each output permutation is equally likely. With no FILE, or when FILE is -, read standard input.
shuf [-e|--echo]
[-i|--input-range]
[-n|--head-count]
[-o|--output]
[--random-seed] [--random-source]
[-r|--repeat]
[-z|--zero-terminated]
[-h|--help]
[-V|--version]
[file-or-args]
Shuffle the input by outputting a random permutation of input lines. Each output permutation is equally likely. With no FILE, or when FILE is -, read standard input.
treat each ARG as an input line
<LO-HI>treat each number LO through HI as an input line
<COUNT>output at most COUNT lines
<FILE>write result to FILE instead of standard output
<STRING>seed with STRING for reproducible output
<FILE>get random bytes from FILE
output lines can be repeated
line delimiter is NUL, not newline
Print help
Print version
file-or-args]v(uutils coreutils) 0.10.0
Randomize the order of lines in a file and output the result:
shuf path/to/file
Only output the first 5 entries of the result:
shuf [-n|--head-count] 5 path/to/file
Write the output to another file:
shuf path/to/input_file [-o|--output] path/to/output_file
Generate 3 random numbers in the range 1-10 (inclusive, numbers can repeat):
shuf [-n|--head-count] 3 [-i|--input-range] 1-10 [-r|--repeat]
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail.