I know my title is not much self-explanatory but let me try to explain it here.
I have a file name test.txt which has some duplicate lines. Now, what I want
test.txt
This might work for you:
sort -u -o test.txt test.txt