Hint: Install packages with 'apt install' command [OK]
Common Mistakes:
Confusing 'apt update' with installation
Using 'apt remove' to install packages
Trying 'apt upgrade' to add new software
2. Which of the following is the correct syntax to update the package list on a Debian-based system?
easy
A. apt update
B. apt install update
C. apt upgrade
D. apt remove update
Solution
Step 1: Identify the command to refresh package lists
apt update downloads the latest package information from repositories.
Step 2: Understand other commands
apt upgrade installs available updates, not refreshes lists; others are invalid.
Final Answer:
apt update -> Option A
Quick Check:
Refresh package list = apt update [OK]
Hint: Use 'apt update' to refresh package info before upgrades [OK]
Common Mistakes:
Using 'apt upgrade' to update package lists
Adding package names to 'apt update'
Confusing 'apt remove' with update commands
3. What will be the output of the following commands sequence?
sudo apt update
sudo apt upgrade -y
medium
A. The system installs new packages listed in the upgrade command.
B. The system refreshes package lists and upgrades all upgradable packages automatically.
C. The system removes all outdated packages without confirmation.
D. The system only updates package lists but does not upgrade any packages.
Solution
Step 1: Analyze sudo apt update
This command refreshes the package lists from repositories to get the latest versions.
Step 2: Analyze sudo apt upgrade -y
This command upgrades all installed packages that have updates available, and the -y flag confirms automatically.
Final Answer:
The system refreshes package lists and upgrades all upgradable packages automatically. -> Option B
Quick Check:
Update + upgrade -y = refresh and auto-upgrade [OK]
Hint: Update lists then upgrade with -y to auto-confirm [OK]
Common Mistakes:
Thinking upgrade installs new packages
Assuming remove happens automatically
Believing update upgrades packages
4. You run apt remove package_name but get an error saying the package is not installed. What is the likely cause?
medium
A. The package is already removed but still listed in the system.
B. You need to run apt update before removing packages.
C. The package name is misspelled or does not exist on the system.
D. You must use apt upgrade before removing packages.
Solution
Step 1: Understand the error context
If apt remove says the package is not installed, it means the system cannot find that package installed.
Step 2: Identify common causes
Most often, this happens because the package name is wrong or the package was never installed.
Final Answer:
The package name is misspelled or does not exist on the system. -> Option C
Quick Check:
Remove error = wrong or missing package name [OK]
Hint: Check package name spelling before removing [OK]
Common Mistakes:
Trying to update before removing
Assuming upgrade is needed before remove
Ignoring error and forcing removal
5. 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
A.
apt update
apt upgrade -y
apt remove oldapp -y
B.
apt upgrade -y
apt update
apt remove oldapp -y
C.
apt remove oldapp -y
apt update
apt upgrade -y
D.
apt update
apt remove oldapp -y
apt upgrade -y
Solution
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.
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.