Packages and Binaries
When something behaves unexpectedly, confirm what binary is being executed and where it came from.
Core commands
Section titled “Core commands”which <command>type <command> # show whether it is a binary, alias, or shell builtinwhereis <command> # show likely binary and manpage locations<command> --versionapt list --installed # list installed packages on Debian-based systemsdnf list installed # list installed packages on RPM-based systemsrpm -q <package> # query one RPM package by namedpkg -l | grep <package> # search installed Debian packagesWhat to check
Section titled “What to check”Binary path:
which <command>readlink -f $(which <command>) # resolve symlinks to the real binaryPackage ownership on Debian-based systems:
dpkg -S /path/to/filePackage ownership on RPM-based systems:
rpm -qf /path/to/fileWhat matters
Section titled “What matters”- Packaged binaries usually live in
/usr/binor/usr/sbin. - Locally installed tools often land in
/usr/local/bin. - Custom software may live in
/optor a team-owned directory. - Multiple versions of the same command in
PATHcause a lot of confusion.
Common mistake
Section titled “Common mistake”Do not assume the binary you run interactively is the same one a service uses. Check ExecStart= in the unit file if systemd owns it.