File: coreutils.info, Node: shuf invocation, Next: uniq invocation, Prev: sort invocation, Up: Operating on sorted files 7.2 ‘shuf’: Shuffling text ========================== ‘shuf’ shuffles its input by outputting a random permutation of its input lines. Each output permutation is equally likely. Synopses: shuf [OPTION]... [FILE] shuf -e [OPTION]... [ARG]... shuf -i LO-HI [OPTION]... ‘shuf’ has three modes of operation that affect where it obtains its input lines. By default, it reads lines from standard input. The following options change the operation mode: ‘-e’ ‘--echo’ Treat each command-line operand as an input line. ‘-i LO-HI’ ‘--input-range=LO-HI’ Act as if input came from a file containing the range of unsigned decimal integers LO...HI, one per line. ‘shuf’’s other options can affect its behavior in all operation modes: ‘-n COUNT’ ‘--head-count=COUNT’ Output at most COUNT lines. By default, all input lines are output. ‘-o OUTPUT-FILE’ ‘--output=OUTPUT-FILE’ Write output to OUTPUT-FILE instead of standard output. ‘shuf’ reads all input before opening OUTPUT-FILE, so you can safely shuffle a file in place by using commands like ‘shuf -o F