Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

shuf

Some strings on this page have not been translated yet. You can help by translating them on Weblate.
v0.13.0
shuf [OPCIÓN]... [ARCHIVO]
shuf -e [OPCIÓN]... [ARG]...
shuf -i LO-HI [OPCIÓN]...

Mezclar la entrada mostrando una permutación aleatoria de líneas de entrada. Cada permutación de salida es igualmente probable. Sin ARCHIVO, o cuando ARCHIVO es -, leer entrada estándar.

Options

--echo, -e

treat each ARG as an input line

--input-range=<LO-HI>, -i <LO-HI>

treat each number LO through HI as an input line

--head-count=<COUNT>, -n <COUNT>

output at most COUNT lines

--output=<FILE>, -o <FILE>

write result to FILE instead of standard output

--random-seed=<STRING>

seed with STRING for reproducible output

--random-source=<FILE>

get random bytes from FILE

--repeat, -r

output lines can be repeated

--zero-terminated, -z

line delimiter is NUL, not newline

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 under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.