You can use the “head” command in the terminal to display the first n lines of a file in Linux. By default, the “head” command displays the first 10 lines of the file.
For example, to display the first 10 lines of a file “filename” with line numbers, use the following command:
cat -n filename | head
You can change the number of lines displayed by specifying the -n option followed by the desired number of lines. For example, to display the first 20 lines:
cat -n filename | head -n 20