Look at the first 3 lines of a file


#1

Transfered from Linux Config Disqus comments:

Question:
What command could you use to look at the first 3 lines of a file named “grades.report” if you had such a file? What command would you use to see the last 2 lines?
Answer:
head command without any options will return first 10 lines of any given text file supplied as an argument. However, using -20 option will return first 20 lines. Therefore,


head -3 grades.report  

returns first 3 lines and


tail -3 grades.report 

returns last 3 lines of a file grades.report.


#2