Select random lines from a file September 27, 2022 by Tarik Use shuf with the -n option as shown below, to get N random lines: shuf -n N input > output