sort -u infile > outfile # or (you might many some of uniq's extra options): sort infile | uniq > outfile