| shuf(1) | General Commands Manual | shuf(1) |
NAME¶
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.
SYNOPSIS¶
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]
DESCRIPTION¶
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.
OPTIONS¶
- -e, --echo
- treat each ARG as an input line
- -i, --input-range <LO-HI>
- treat each number LO through HI as an input line
- -n, --head-count <COUNT>
- output at most COUNT lines
- -o, --output <FILE>
- write result to FILE instead of standard output
- --random-seed <STRING>
- shuf-help-random-seed
- --random-source <FILE>
- get random bytes from FILE
- -r, --repeat
- output lines can be repeated
- -z, --zero-terminated
- line delimiter is NUL, not newline
- -h, --help
- Print help
- -V, --version
- Print version
- [file-or-args]
VERSION¶
v(uutils coreutils) 0.7.0
EXAMPLES¶
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.
| shuf (uutils coreutils) 0.7.0 |