Multiple choice technology operating systems

How can you print the first 10 line of a file

  1. head +10 file

  2. cat file

  3. tail -10 file

  4. head -10 file

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

head -10 file displays the first 10 lines. tail -10 shows the last 10. cat displays entire file. head +10 is not valid syntax (that's how tail works).

AI explanation

head -10 file prints the first 10 lines of a file, using head's -N option to specify the line count. head +10 file is invalid/non-portable syntax on modern head implementations (the +N form, where supported historically, meant "start printing from line N to the end," not "first 10 lines"). cat file dumps the entire file, not just the first 10 lines. tail -10 file prints the last 10 lines, the opposite of what's requested.