randomly choose n rows from a file linux

Shell
shuf -n 1000 file
Source

Also in Shell: