SHUF(1)
π SHUF(1) β General Commands Manual π
okay bestie, gather round, because shuf is literally the moment. it's the shuf command from the General Commands Manual, and it's about to rearrange your whole life (or at least your stdin).
β¨ NAME β¨
shuf β shuffle the input by outputting a random permutation of input lines π
and like, every single output permutation is equally likely, no cap, it's not playing favourites. with no FILE, or when FILE is -, it reads standard input. π
π¦ SYNOPSIS π¦
shuf [OPTION]... [FILE]
shuf -e [OPTION]... [ARG]...
shuf -i LO-HI [OPTION]...
three whole vibes, pick your fighter. π
πΈ 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.
that's it, that's the whole personality β it takes your lines, it mixes them up, and every possible order has the exact same chance of showing up. it's giving fairness icon. β¨
not me feeding it a file and getting a completely different order every time β because that's literally the point, bestie π
π OPTIONS π
-e,--echoβ treat each ARG as an input line π (so instead of a file, you just hand it words and it goes feral)-i,--input-range <LO-HI>β treat each number LO through HI as an input line π’-n,--head-count <COUNT>β output at most COUNT lines, like, we're not doing the whole thing today π«Ά-o,--output <FILE>β write the result to FILE instead of standard output πΎ--random-seed <STRING>β seed with STRING for reproducible output π± (yes bestie, same seed = same shuffle, science)--random-source <FILE>β get random bytes from FILE π²-r,--repeatβ output lines can be repeated π-z,--zero-terminatedβ line delimiter is NUL, not newline π« (theNULone, not the newline one, iykyk)-h,--helpβ Print help π-V,--versionβ Print version π[file-or-args]β yeah, it's listed right there at the bottom of the options, iconic placement honestly π
β VERSION β
v(uutils coreutils) 0.12.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.
π«Ά real talk: as uutils is a work in progress, a couple of these examples might just not go how you want. it's not you, it's the work in progress era. π
and that's the whole page bestie, slay. this lovely little doc is served up by the General Commands Manual crew, rocking v(uutils coreutils) 0.12.0, and it was stamped with the date 2026-09-25. go shuffle something, you ate. πβ¨π
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms