What is Head Command?
Head command is used to display first part of files given to its standard output.
What is Tail Command?
Tail is a program available on Unix, Unix-like systems used to display the last number of data of the given input or piped data.
How to use Head Command?
By default head command list first ten lines of a file. In following example I will show you the first Ten lines of /etc/shadow file.
head /etc/shadow
Check your desired number of lines using head command
Now, you will see first 15 lines of /etc/shadow file
-n used to define lines.
15 it is number of lines
head -n15 /etc/shadow
How to use Tail Command?
Like head command, tail is also display 10 lines by default but these are last 10 lines of a file. use following command to list last lines of a file.
tail /etc/shadow
Now if you want to see last 15 lines of /etc/shadow file. Then run following command
tail -n15 /etc/shadow
That’s about it!
The post How to use Head and Tail command in Linux appeared first on Osgrove.
Lo and behold 👐, Ubuntu MATE 26.10 (Stonking Stingray) is here! 🎊 We are back…
This article provides a guide demonstrating how to deploy Kiwix Server on Ubuntu VPS. What…
A few months ago, we introduced Myna, our project to bring private, local speech-to-text dictation…
Ubuntu 26.10 “Stonking Stingray” arrives at a time when AI tools are accelerating vulnerability discovery.…
One of the best things about Rust is how easy it is to get started.…