Must know commands

uniq
What is uniq?
uniq(1)                  - report or filter out repeated lines in a file
DESCRIPTION
     The
uniq utility reads the specified input_file comparing adjacent lines,
     and writes a copy of each unique input line to the output_file.  If
     input_file is a single dash (`
-') or absent, the standard input is read.
     If output_file is absent, standard output is used for output.  The second
     and succeeding copies of identical adjacent input lines are not written.
     Repeated lines in the input will not be detected if they are not adja-
     cent, so it may be necessary to sort the files first.
uniq -d
only show lines which occur more then once
uniq -u
only show lines that doesn’t occur more then once
uniq
show the input where the repeated lines are filtered out
uniq -c
show the count of number of times the line occur


sort
What is sort?
sort(1)                  - sort lines of text files
sort -b
ignoring blank characters
sort -d
sorts in alphabetic order (only characters, numbers and blank characters have impact)
sort -f
considers big letters as small and ignores the difference.
sort -n
sort in nummerical order
sort -r
turn the sort order upside down
sort -t
add a field separator after -t
sort -k
sort the field number after -k


wc
What is wc?
wc(1)                    - word, line, character, and byte count
wc
shows count of lines, words and character’s
wc -w
show only amount of words
wc -l
show only amount of lines
wc -c
show the amount of character’s


cat
What is cat?
cat(1)                   - concatenate and print files
cat -b
number the non-blank output lines
cat -n
number the output lines
cat -v
display non-printing characters

cut
What is cut?
cut(1)                   - cut out selected portions of each line of a file
cut -c2
show only the second column
cut -1-3
show only character’s from column 1 to 3
cut -c2-
show only character’s from column 2 to and all the other columns
cut -c-10
show only character’s from columns 1 to 10
cut -f2
show field number 2
cut -d’:’ -f1 /etc/passwd
show field number 1 when the field delimiter is :


grep
What is grep?
grep(1)              - Print lines matching a pattern
grep -i
ignore case sensitive matching
grep -c
show the amount of matched patterns
grep -n
show the line number of matched patterns
grep -l
show a list of files containing the matched patterns