How to print/display the first line of a file in Unix?



How to print/display the first line of a file in Unix?..

Answer / Rishabh Kanthariya

To display the first line of a file in Unix, you can use the `head` command with an argument specifying the number of lines. In this case, since we want only the first line, we use `head -n 1`. Here's an example: `head -n 1 filename.txt`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Unix General Interview Questions

What are system variables in unix?

1 Answers  


What do you understand by the term wild-card interpretation?

1 Answers  


What is the core of unix operating system?

1 Answers  


Give a brief idea about representation of devices in unix.

1 Answers  


command to display different lines that are found when compare two files?

2 Answers   HP,


What is .profile unix?

1 Answers  


Why kernel is known as the heart of unix os?

1 Answers  


How do I remove 30 days old files in unix?

1 Answers  


How do I search for a grep file in unix?

1 Answers  


What is the best free unix based os?

1 Answers  


following two file are file a file b 110 aab 330 xxl i want the output like file a fileb 110 xxl 330 aab give solution ?

3 Answers   Accenture,


What is the ‘nohup’ in unix?

1 Answers  


Categories