How to Display Repeated Lines Using `uniq` Command in Linux
The `-d`
option only prints duplicate lines:
uniq -d kt.txt
uniq Command in Linux with Examples
The uniq command in Linux is a command-line utility that reports or filters out the repeated lines in a file. In simple words, uniq is the tool that helps to detect the adjacent duplicate lines and also deletes the duplicate lines. uniq filters out the adjacent matching lines from the input file(that is required as an argument) and writes the filtered data to the output file.
Table of Content
- Syntax of uniq Command
- Common Options of the uniq Command
- Examples of Using the `uniq` Command
- How to Remove Duplicate Lines Using `uniq` Command
- How to Count Duplicate Lines Using `uniq` Command in Linux
- How to Display Repeated Lines Using `uniq` Command in Linux
- How to Display all Duplicate Lines Using `uniq` Command in Linux
- How to Display Unique Lines Using `uniq` Command in Linux
- Skipping First N Characters (-s option) Using `uniq` Command in Linux
- Limiting Comparison to First N Characters (-w option) Using `uniq` Command in Linux
- Case-Insensitive Comparison (-i option) Using `uniq` Command in Linux
- NULL Terminated Output (-z option) Using `uniq` Command in Linux