[kanchilug] 1D1C - head

  • From: Dhanasekar <tkdhanasekar@xxxxxxxxx>
  • To: ilugc@xxxxxxxxxxxxx, kanchilug@xxxxxxxxxxxxx
  • Date: Fri, 26 Aug 2022 06:00:00 +0530

head - output the first part of files

To display the first 10 lines default of head command
$ head file.txt

To show the first 6 lines of file.txt
$ head -n 6 file.txt

To displaying specific number of bytes ex.10 bytes
$ head -c 10 example1.txt

To displaying the file name tag
$ head -v file.txt

To display multiple files
$ head file1.txt file2.txt

To display the first 5 lines of each file
$ head -n 5 file1.txt file2.txt

To redirect output to a text file
$ head file.txt > output.txt

To display head with Pipeline
$ ls /etc | head
$ ls -t | head -n 4 | sort



regards,
T.Dhanasekar

Other related posts:

  • » [kanchilug] 1D1C - head - Dhanasekar