Basic Linux Tutorial
Computer Tutorial

Working with Files Contents



Working with Files Contents

head

the head command are used to display first part of the file. It display first 10 lines of file.
Synopsis :
head [option] file
Example :
head   file1.txt
Option
-c   print the first N bytes of each files
-n   print first N lines instead of the first 10
-q   never print the headers giving file name
-v   always print header giving file names

tail

The tail command are used to print the last part of the file. It prints last 10 lines as standard output.
Synopsis :
tail [option] file
Example :
tail   file1.txt
Option
-c   print the first N bytes of each files
-n   print first N lines instead of the first 10
-q   never print the headers giving file name
-v   always print header giving file names

cat

cat command are used to display the content of text file and to combine several files to one file. It is also use to create a file.
Synopsis :
cat [option] file
Example :
cat   file1.txt
Option
-b   add line number to non blank lines
-n   add line number to all lines
-s   squeeze blank line to one line
-E   show $at the end of line
-T   show N instant of tabs