How do I read the first line of a file using cat?
cat
You could use cat file.txt | head -1, but it would probably be better to use head directly, as in head -1 file.txt.
cat file.txt | head -1
head -1 file.txt