Home » Questions » Computers [ Ask a new question ]

Bash command to cut output after x number of lines

Bash command to cut output after x number of lines

I'm looking for a bash command, which I can use to limit the number of lines of a file or another command output. E.g.

Asked by: Guest | Views: 228
Total answers/comments: 1
Guest [Entry]

"Use head:

ls -l | head -n 15

10 lines is the default. Read the head man page for more options.

(older versions of head also support usage without the explicit -n as in head -15)"