How to view only the first n lines of a file?

I tried the head +10 and it didn’t work.

+3
source share
2 answers

Have you tried the man page for the head?

head -n 10 filename

+17
source

The head is a great tool, but you can also try:

sed 10q path

For fans of code golf, sed is always better than the head :)

+5
source

Source: https://habr.com/ru/post/1717439/


All Articles