Bird
0
0

You want to write a script that updates package lists, upgrades all packages, and then removes unused packages automatically. Which sequence of commands is correct?

hard📝 Application Q9 of 15
Linux CLI - Package Management
You want to write a script that updates package lists, upgrades all packages, and then removes unused packages automatically. Which sequence of commands is correct?
Asudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
Bsudo apt upgrade && sudo apt update && sudo apt autoremove
Csudo apt autoremove && sudo apt update && sudo apt upgrade -y
Dsudo apt clean && sudo apt update && sudo apt upgrade
Step-by-Step Solution
Solution:
  1. Step 1: Order commands logically

    First update package lists, then upgrade packages, finally remove unused packages.
  2. Step 2: Check flags and order

    Use '-y' to auto confirm upgrades and removals; order matters for success.
  3. Final Answer:

    sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y -> Option A
  4. Quick Check:

    Update -> upgrade -> autoremove with '-y' flags [OK]
Quick Trick: Chain update, upgrade, autoremove with '&&' and '-y' [OK]
Common Mistakes:
  • Wrong command order
  • Missing '-y' causing prompts
  • Using 'clean' instead of 'autoremove'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes