How to change default lines?

0243

To change the default number of lines displayed by the head command, you can use the -n option followed by the desired number of lines. For example, if you want to display the first 5 lines of a file, you would use:

head -n 5 filename.txt

Replace filename.txt with the name of your file. This command will show the first 5 lines instead of the default 10.

Example

If you have a file named example.txt and you want to see the first 3 lines, you would run:

head -n 3 example.txt

This will output the first 3 lines of example.txt.

Note

The -n option can be used with any positive integer to specify how many lines you want to display.

0 Comments

no data
Be the first to share your comment!