Bird
0
0

You want to write a script that updates the package list, upgrades all packages, and then removes a package named oldapp. Which sequence of commands is correct?

hard📝 Application Q15 of 15
Linux CLI - Package Management
You want to write a script that updates the package list, upgrades all packages, and then removes a package named oldapp. Which sequence of commands is correct?
A<pre>apt update apt upgrade -y apt remove oldapp -y</pre>
B<pre>apt upgrade -y apt update apt remove oldapp -y</pre>
C<pre>apt remove oldapp -y apt update apt upgrade -y</pre>
D<pre>apt update apt remove oldapp -y apt upgrade -y</pre>
Step-by-Step Solution
Solution:
  1. Step 1: Understand the correct order of package management commands

    First, update the package list with apt update to get latest info, then upgrade installed packages with apt upgrade -y, and finally remove unwanted packages.
  2. Step 2: Check each option's order

    apt update
    apt upgrade -y
    apt remove oldapp -y
    follows the correct order: update, upgrade, then remove. Others have wrong sequences that may cause errors or outdated upgrades.
  3. Final Answer:

    apt update apt upgrade -y apt remove oldapp -y -> Option A
  4. Quick Check:

    Update -> Upgrade -> Remove sequence [OK]
Quick Trick: Always update before upgrade, remove last [OK]
Common Mistakes:
  • Upgrading before updating package lists
  • Removing packages before upgrading
  • Skipping update before upgrade

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes