>cat, head, tail, wc Examples

cat, head, tail, wc Examples

cat - concatenate files and print on the standard output

cat [OPTION]... [FILE]...

-n:  number all output lines
-s:  suppress repeated empty output lines
-T:  display TAB characters as ^I


head - output the first part of files

head [OPTION]... [FILE]...

-n <num>: print the first <num> lines instead of the first 10; with the leading '-', print all but the last <num> lines of each file

-c <num>: print the first <num> bytes of each file; with the leading '-',  print  all  but the last <num> bytes of each file


tail - output the last part of files

tail [OPTION]... [FILE]...

-n <num>: output  the last <num> lines, instead of the last 10; or use -n +<num> to output starting with line <num>

-f: output appended data as the file grows


wc - print newline, word, and byte counts for each file

wc [OPTION]... [FILE]...

-c: print the byte counts
-m: print the character counts
-l: print the newline counts
-L: print the maximum display width
-w: print the word counts

for further information see the manual pages cat(1), less(1), head(1), tail(1), wc(1)

all examples assembled by andreas schmidt for the IC3K 2022 conference