head - output the first part of files
head print default first ten lines of output
We can also print specific numbers of line using below command
(Here we are printing 5 lines, you can change number of lines
$ head -5 messages
tail - output the last part of files
tail print default first ten lines of output
We can also print specific numbers of line using below command
(Here we are printing 5 lines, you can change number of lines
$ tail -5 messages
Sometimes, we need continuously print last lines from log file during troubleshooting
Here, we can use parameter -f with tail command
$ tail -f messages
We also have command for this
$ tailf messages
Thank you!
On this page of the site you can watch the video online Linux Basic Command: "head" & "tail" with a duration of hours minute second in good quality, which was uploaded by the user Virtu Mentor 22 May 2020, share the link with friends and acquaintances, this video has already been watched 98 times on youtube and it was liked by 6 viewers. Enjoy your viewing!