A systems administrator is writing a troubleshooting script that calls head on whatever files are passed on the command line. The script should show the first 15 lines of each file and print a filename header (the "> filename <" line) even when the script receives only a single file. Which head invocation satisfies these requirements if the shell variable $FILES already holds the list of filenames?
(Note: assume a GNU/Linux system with the standard coreutils implementation of head.)
The -n 15 (or --lines=15) option limits output to the first 15 lines. The -v/--verbose option forces head to print the header that includes the filename every time, regardless of how many files are supplied. Together they meet both conditions.
Using -q/--quiet hides headers, so that choice fails. The form that omits -v relies on head's default behaviour, which prints a header only when more than one file is processed, so it would not show the header when a single file is passed. The -c option measures bytes rather than lines, so it does not meet the 15-line requirement.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the -n option in the head command do?
Open an interactive chat with Bash
What is the purpose of the -v option in head?
Open an interactive chat with Bash
How does the -c option differ from -n in head?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access