Shuf

From LQWiki
Jump to navigation Jump to search

shuf shuffles input and generates random permutations; shuf is part of the GNU coreutils

Origin

Provided by the GNU Coreutils: man page

Overview

This is not a complete list of options:

  • -e treat each ARG as an input
  • -i specifies a range of numbers
  • -n how many lines to generate
  • -o save output to file
  • -z ends with 0 byte instead of newline

Examples

$ shuf -e bagels brownies oranges coke
brownies
coke
bagels
oranges


Generate 10 random numbers from 1000 to 10000:

shuf -i 1000-10000 -n 10

Generate 10 random numbers and save to file:

shuf -i 1000-10000 -n 10 -o mynumbers.txt

Roll 5 dice:

shuf -i 1-6 -n 5

See also

External links

This article is a stub and needs to be finished. Plunge forward and help it grow!