What is Linux filter?
A filter is a program that takes plain text (stored in a file or generated by another program) as standard input, converts it to a meaningful format, and then returns it as standard output. Linux has several filters.
Some of the most commonly use filters are describe below.
1. cat : Display the text of the file line by line.
2. head: Shows the first n lines of the specified text file. If no number of lines is specifie, the first 10 lines are print by default.
head [-number_of_lines_to_print] [path]
3. Tail: Works the same as the head, but in reverse order. The only difference from Tail is that the line is return from bottom to top.
tail [-number_of_lines_to_print] [path]
4. Sort: Sorts the rows alphabetically by default, but there are many options available to change the sorting mechanism. Check out the main page to see what you can do.
sort [-options] [path]
5. uniq: Remove duplicate lines. uniq has the limitation that you can only remove consecutive duplicate rows (although you can fix this by using plumbing). Suppose you have the following date:
uniq [options] [path]
6. wc: wc command gives the number of lines, words and characters in the data.
wc [-options] [path]
7. grep: grep is use to search a particular information from a text file.
grep [options] pattern [path]
8. tac: tac is the opposite of a cat and works the same. H. Instead of printing lines 1 through n, print lines n through line 1. This is the opposite of the cat command.
9. nl : nl is use to number the lines of our text data.
nl [-options] [path]