0
0
Linux CLIscripting~20 mins

apt (Debian/Ubuntu) basics in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Apt Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of apt list --installed | grep bash?
You run the command apt list --installed | grep bash on a Debian/Ubuntu system. What will this command output?
Linux CLI
apt list --installed | grep bash
ALists all available packages containing 'bash' but not necessarily installed ones.
BShows an error: 'bash' is not a valid option for apt list.
COutputs nothing because 'grep' is not installed by default.
DLists all installed packages whose names contain 'bash', showing their versions and status.
Attempts:
2 left
💡 Hint
Think about what apt list --installed does and how grep filters output.
💻 Command Output
intermediate
2:00remaining
What error does this command produce: apt-get install --dry-run nonexistent-package?
You try to simulate installing a package that does not exist using apt-get install --dry-run nonexistent-package. What error message or output will you get?
Linux CLI
apt-get install --dry-run nonexistent-package
AE: Unable to locate package nonexistent-package
BSimulates installation successfully with no errors
CSyntax error: unknown option '--dry-run'
DWarning: Package already installed
Attempts:
2 left
💡 Hint
Think about what happens when you try to install a package that does not exist in the repositories.
🔧 Debug
advanced
2:00remaining
Why does this command fail: apt update && apt upgrade -y run as a normal user?
You run apt update && apt upgrade -y as a normal user (not root). The command fails. What is the reason?
Linux CLI
apt update && apt upgrade -y
AThe system must be offline for 'apt upgrade' to work.
BNormal users do not have permission to update package lists or upgrade packages; root privileges are required.
CThe '-y' option is invalid and causes the command to fail.
DThe command syntax is incorrect; 'apt upgrade' must come before 'apt update'.
Attempts:
2 left
💡 Hint
Think about who can change system packages and update system files.
🚀 Application
advanced
2:00remaining
How to list all packages that can be upgraded using apt?
You want to see which packages have updates available before upgrading. Which command will correctly list all upgradable packages?
Aapt list --upgradable
Bapt show upgradable
Capt search --upgrade
Dapt-get list --upgradeable
Attempts:
2 left
💡 Hint
Check the official apt command options for listing upgradable packages.
🧠 Conceptual
expert
2:00remaining
What is the effect of running apt-get clean on a Debian/Ubuntu system?
You run apt-get clean. What does this command do?
ARemoves all installed packages that are no longer needed.
BUpdates the package lists from the repositories.
CDeletes all cached package files from the local repository to free disk space.
DUpgrades all installed packages to the latest version.
Attempts:
2 left
💡 Hint
Think about what 'clean' means in the context of package management cache.