shuf file --output file: in-place shuffling
Yes - per the documentation - it should be safe to shuffle a file in-place:
-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 likeshuf -o F <F
andcat F | shuf -o F
.