[head] Print the first N lines

Created on November 30, 2026

Use -n with the number of lines to display. This example prints the first two lines of the input.

printf "one\ntwo\nthree\nfour\n" | head -n 2
one
two
Shell command