Displaying first line from a file in UNIX

Using head command, we can display the first line.
head -1 filename.txt

For printing first "n" lines from the file, we can use
head -n filename.txt

Another way: (using sed)
sed ā€˜2,$ dā€™ file.txt

How it works ?
"d" tells sed to remove all lines from second line to the end of file ($).
So, you can see only the first line.