Know your distribution and its packages
Identify the system, choose its package tools and inspect before installing.
By the end of this lesson
- Choose a package manager from distribution evidence
- Separate repository metadata from installed packages
- Inspect a package without changing the system
Your environment: Select the matching distribution branch. No root access is needed for the package queries. Setup help
Start with evidence, not a familiar command
Read /etc/os-release and look at ID, ID_LIKE and VERSION_ID. A machine running Linux does not automatically use apt. Debian and Ubuntu normally use apt with dpkg underneath; Fedora and RHEL-family systems use DNF and RPM; Arch uses pacman; openSUSE uses zypper; Alpine uses apk. Exact commands can differ by installed release.
Distinguish package availability from installation. Repository metadata describes what could be installed; the local package database describes what is installed. Refreshing metadata and upgrading installed software are different operations. An unsuccessful package lookup may mean the name differs on this distribution, rather than that the feature is impossible.
Plan changes before making them
For administration, note the package name, source repository, version, expected dependencies and recovery plan. Read the proposed transaction before accepting it. A tutorial that installs tools everywhere by default can make a small troubleshooting session much harder to reproduce.
The lab uses read-only inspection. On a disposable VM you can practise installation later with the distribution’s own documentation, but you do not need root to complete this lesson. Record which package supplies a familiar executable when your package tools support ownership queries.
See it in context
Worked example
Select just the branch that matches your system.
cat /etc/os-release
# Debian / Ubuntu:
# dpkg-query -W bash
# Fedora / RHEL / openSUSE:
# rpm -q bash
# Arch:
# pacman -Q bash
# Alpine:
# apk info busyboxRemove the comment marker only from the matching query. These inspect installed packages; they do not install or upgrade them.
Your turn
Practical lab
Write an inventory note for your own lab machine.
Run commands in your own lab. This website displays instructions; the practice terminal below helps you rehearse the syntax.
1. Prepare your workspace
mkdir -p "$HOME/training4linux/packages"
cd "$HOME/training4linux/packages"2. Complete the task
- Read /etc/os-release and record ID plus VERSION_ID when provided.
- Choose the matching installed-package query above and record the output.
- Explain the difference between refreshing a repository index and upgrading packages.
3. Check your result
- Your notes identify the distribution rather than just saying Linux.
- You have recorded a package query result or its honest not-installed result.
- No installation or upgrade was needed.
Need a hint?
Use the comments in the worked example as a menu, not as a script to run all branches.
Reveal a worked solution
Compare this with your approach after trying the task. More than one valid solution may exist.
cat /etc/os-release > system.txt
# Append the output of your chosen read-only query to system.txt.
cat system.txtAfter the lab: Keep system.txt as the start of your machine inventory.
Common mistakes to avoid
- Do not mix package-manager examples from different distributions.
Check your understanding
Knowledge check
Answer all 3 questions correctly to pass. Retry as often as you need; your best score is kept.
Your lesson progress
Not started · Best score: 0% · Attempts: 0
Practical completion is self-reported. Progress is linked to a private cookie in this browser and stored on the site. Clearing that cookie loses access to it. Manage or erase progress.