How to display first lines of a file?

095

To display the first lines of a file, you can use the head command in Unix-like operating systems. Here’s how to do it:

Syntax:

head -n <number> <filename>

Example:

If you want to display the first 5 lines of a file named example.txt, you would run:

head -n 5 example.txt

Additional Notes:

  • By default, head displays the first 10 lines of a file if you do not specify the -n option.
  • You can replace <number> with any positive integer to specify how many lines you want to see from the beginning of the file.

If you have any more questions or need further clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!