Basic Linux Tutorial
Computer Tutorial

Filter ( tee, grep and cut ) Commands

Filter ( tee, grep and cut ) Commands


The tr command is used to translate, delete or squeeze character.
Synopsis :
tr   [option] set1   set2
Example :
echo   “linux” | tr “[a –z]” “[A – Z]”
-c   complete the set of character in string
-d   delete the character in set 1
-s   replaces repeated character listed in the set 1 with single occurrence
-t   truncates set 1


wc command are used to find the number of lines, words and characters in a file.
Synopsis :
wc   [option]   files
Example :
wc   –l   Linux.bat
-l   print number of lines in a file
-w   print number of words in a file
-c   display the content of bytes in a file
-m   print the count of characters from a files
-l   prints only the length of the longest lines in a file


sort command is used to order the elements or text. It has a capability of sorting numerical values and string.
Synopsis :
sort [option]   file name
Example :
sort   file1.txt
-b   ignore leading spaces in each line.
-d   used dictionary sort order.
-m   case based on month (consider first 3 letter).
-n   uses numeric sorting.
-r   reverse order sorting
-k   sort files based on the data in the specified field portion
-u   suppresses duplicate lines
-t   input field separator