Linux: How to generate list of unique lines in a text file phptuts June 22, 2020 We have two methods: Method 1: cat ok.txt |sort | uniq > ok2.txt Method 2: sort -u ok.txt >> ok2.txt phptuts