$ sample 10 somelongfile.txt ## to get 10 random lines $ some long command | sample 50 > mysample.txt