LPIC-1 Exam 101 free question 4 / 10 · Domain 2: Linux Installation and Package Management
You want to check the description of a downloaded toolkit_2.1_all.deb, such as its version and the packages it depends on, before installing it on the system. toolkit is not installed yet. What do you run?
- dpkg -s toolkit_2.1_all.deb
- dpkg -I toolkit
- dpkg -I toolkit_2.1_all.deb
- dpkg -s toolkit
Show the answer and explanation
Answer: C
Why this is correct
dpkg -I (--info) takes a package file (.deb) and prints the control information inside it, such as the package name, version, dependencies, and description. Because it can examine the file as it is before installation, it suits the purpose of checking what is inside before installing. Even for a package that is not installed, you can read it as long as you have the .deb at hand.
Why the other options are wrong
"dpkg -s toolkit_2.1_all.deb" … -s (--status) takes the name of a package and prints the state of a package installed on the system from the dpkg database. It does not read the file even if you give it a .deb file name.
"dpkg -s toolkit" … -s prints the state of a package that is installed on the system. toolkit is not installed yet, so you get no description.
"dpkg -I toolkit" … What you give to -I is a .deb file. If you give a package name, there is no file of that name and nothing can be examined.
Uppercase and lowercase
dpkg options differ in meaning by case. -I only shows the description of a .deb, but lowercase -i installs the .deb on the system. If a dependency is missing, -i can stop part-way through, so looking at the dependencies with -I before installing reduces rework.
Go to the LPIC-1 Exam 101 practice app (10 free questions; purchase unlocks all questions)