Does anyone know of a simple one liner to read the first line of a file in bash?
read -r FIRSTLINE < filename
Same result as the other answers but faster because it doesn't spawn any process, as "read" is a built-in bash command.
FIRSTLINE=`head -n 1 filename`
Stores the line in a variable for later use (note the inverted apostrophes).
head -n 1 should do the trick
awk 'NR == 1' /etc/passwd