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...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .