Although it's an unconventional application of grep, you can do it in GNU grep using
grep -m1 "" file.txt
It works because the empty expression matches anything, while -m1 causes grep to exit after the first match
-m NUM, --max-count=NUM
Stop reading a file after NUM matching lines.