How to change the number of lines?

0154

To change the number of lines displayed by the head command, you can use the -n option followed by the desired number of lines. Here’s how to do it:

Syntax

head -n [NUMBER] filename.txt

Example

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

head -n 15 example.txt

Additional Notes

  • You can also use a plus sign (+) to display lines starting from a specific line number. For example, head -n +5 filename.txt will display all lines starting from the 5th line to the end of the file.
  • If you omit the -n option, the default is 10 lines.

Feel free to ask if you have more questions or need further clarification!

0 Comments

no data
Be the first to share your comment!