CompTIA Linux+ Linux Installation and Package Management 1 — Questions and Answers
Question 1: Which of the following commands is used to install a package on a system using the YUM package manager?
- yum get [package_name]
- yum install [package_name] (Correct answer)
- yum add [package_name]
- yum update [package_name]
Correct answer: yum install [package_name]
The `yum install [package_name]` command is used to install new software packages on systems that use the YUM (Yellowdog Updater, Modified) package manager, such as CentOS or Fedora. YUM automatically resolves dependencies and fetches the necessary files from configured repositories. This command is fundamental for software management on RPM-based distributions.
Question 2: Which of the following commands is used to update the package database in an APT-based system (Debian/Ubuntu)?
- apt-get update (Correct answer)
- apt update
- apt-get upgrade
- apt upgrade
Correct answer: apt-get update
The `apt-get update` command is used in APT-based systems (like Debian and Ubuntu) to refresh the local package index. It downloads the latest package information from all configured repositories, allowing the system to know which packages are available for installation or upgrade. This step is crucial before installing or upgrading any software to ensure you have access to the most current versions.
Question 3: Which file in a Linux system contains information about the system’s disk partitions?
- /etc/fstab (Correct answer)
- /etc/hostname
- /etc/passwd
- /etc/network/interfaces
Correct answer: /etc/fstab
The `/etc/fstab` file (file system table) contains static information about the file systems that are mounted on the system. It specifies how and where disk partitions, network shares, and other storage devices should be mounted during the boot process. This file is essential for ensuring that all necessary file systems are available when the system starts.
Question 4: What does the dpkg command do in a Debian-based system?
- It installs, removes, or provides information about .deb packages. (Correct answer)
- It installs RPM packages.
- It updates the system’s package database.
- It handles software repositories and dependencies.
Correct answer: It installs, removes, or provides information about .deb packages.
The `dpkg` command is the low-level package manager for Debian-based systems, directly handling `.deb` package files. It can install, remove, configure, and query information about individual packages. While `apt` commands manage repositories and dependencies, `dpkg` is the underlying tool that performs the actual package manipulation.
Question 5: Which of the following commands is used to check disk usage in Linux?
- df
- du (Correct answer)
- ls
- ps
Correct answer: du
The `du` command (disk usage) is used to estimate file space usage by files and directories. It recursively calculates the disk space consumed by a specified directory or file, providing detailed information about how much space individual items are taking up. This is useful for identifying large files or directories that might be consuming excessive disk space.
Which of the following commands is used to install a package on a system using the YUM package manager?