Examers.io
ExamsOrganizationsHow it worksPricingHelp & FAQ
Linux Professional Institute logo

LPI Linux Essentials (010-160)

Domain 3Objective 3

3.3 Turning Commands into a Script (weight: 4) LINUX-ESSENTIALS Practice Questions (Page 7)

Part of the Topic 3: The Power of the Command Line domain, which makes up ~16% of our current practice bank. Linux Professional Institute does not publish an official question count, but from its 60-minute exam (~25–40 total, ~4–6 in this domain), expect 1–2 from this objective — we provide 36 practice questions to prepare you well beyond it. (estimate)

36questions here
8free pages
9concepts

Questions 31–35

  1. 31application · medium

    A Linux administrator needs to rename all files ending with '.txt' in the current directory to have a '.bak' extension. The admin writes a script with a for loop. Which loop correctly iterates over the files and performs the rename?

    Select an answer first
  2. 32application · medium

    A script runs a critical command and needs to exit with an error message if the command fails. The admin writes: 'command' followed by 'if [ $? -ne 0 ]; then echo "Failed"; exit 1; fi'. However, the script always prints 'Failed' even when the command succeeds. What is the likely cause?

    Select an answer first
  3. 33application · easy

    A script is not behaving as expected; it seems to skip an if block even though the condition should be true. The admin wants to trace the execution to see what the script is actually doing. Which command should the admin use to run the script with tracing enabled?

    Select an answer first
  4. 34application · easy

    A script needs to store the number of lines in a file and then compare it to a threshold. The admin writes: 'count=$(wc -l < file.txt)' and then 'if [ $count -gt 10 ]; then ...'. The script works, but the admin wants to make the threshold configurable. What is the best approach?

    Select an answer first
  5. 35application · medium

    A script must check if a user-provided argument is 'start', 'stop', or 'restart' and act accordingly. If the argument is anything else, it should print an error. Which conditional structure is most appropriate?

    Select an answer first
Finished these 5 questions?

Review the revealed explanations, or continue through the curriculum.

Free Basic Practice is a study aid with revealable answers — not a scored exam. Examers.io is independent and not affiliated with or endorsed by Linux Professional Institute. “LINUX-ESSENTIALS” is a trademark of its owner, used for identification only.