Interview Q&A / Linux & Shell
Linux & Shell interview questions
Permissions, processes, pipes and the commands you are expected to know cold.
Prefer rapid revision? Practise Linux & Shell short interview answers →
- How do you find which package a file or command belongs to?
On Debian and Ubuntu use dpkg -S /path/to/file for installed files and apt-file search for files not yet installed. On Red Hat family systems use rpm -qf /path for installed files and dnf provides '*/name' for uninstalled ones.
IntermediateQuick answer1 min read - How do you stop a package from being upgraded on Debian or Ubuntu?
Use sudo apt-mark hold package to freeze it at the current version and apt-mark unhold to release it. For finer control, such as preferring a specific version or repository, use APT pinning in /etc/apt/preferences.d/.
IntermediateQuick answer1 min read - What is a package repository, and why do package managers check GPG signatures?
A repository is a server holding packages and an index that package managers read. Packages and indexes are signed with GPG keys so your system can verify they came from the publisher and were not altered. Adding a third-party repository means trusting its key.
IntermediateQuick answer1 min read