You are writing a Bash script that must iterate over every logical volume on a server. The script expects a simple two-column list that contains only the logical-volume name and its size as a whole-number count of megabytes, with no column headings and no "M" size suffix. Which command produces the required output?
lvs --nameprefixes -o lv_name,lv_size --units m --noheadings
lvs -o lv_name,lv_size --units m
lvs -o lv_name,lv_size --units m --nosuffix --noheadings
lvs -S 'lv_size>0' -o lv_name,lv_size --units m --nosuffix
The command that satisfies all the requirements is:
-o lv_name,lv_size limits the report to the LV name and size columns.
--units m expresses the size in megabytes.
--nosuffix removes the trailing unit letter so the size is a bare number that a script can parse as an integer.
--noheadings suppresses the header row, leaving only data lines.
Each incorrect choice fails at least one of these points:
A command that omits --noheadings shows the header line and therefore breaks the two-column format.
A command that omits --nosuffix leaves the "m" suffix on the size values.
Adding --nameprefixes turns each field into LVM2_FIELD=value pairs, no longer a plain two-column list.
Using -S without also adding --noheadings still leaves the header row intact.
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 '--nosuffix' option do in the 'lvs' command?
Open an interactive chat with Bash
Why is the '--noheadings' option important for the script?
Open an interactive chat with Bash
What does 'lvs -o lv_name,lv_size' do, and why specify these options?
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