Linux Survival Basics
Read-onlySpot Foreign-Architecture Packages
Package dependency output is confusing and you need to see whether the host has non-native architecture packages installed.
Command
dpkg-query -W -f='${Architecture}\t${Package}\n' | awk '$1 != "amd64" && $1 != "all"'
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not assume foreign architecture packages are wrong; some applications require them.
Expected output
Foreign-architecture package rows such as i386 zlib1g:i386.
System impact
Read-only. Nothing changes. dpkg-query prints package architectures and awk filters non-native rows.
Recovery / rollback: no state is changed.
When to use it
Use when debugging multiarch dependency issues, legacy runtime support, or unexpected i386 packages on amd64 servers.
When not to use it
Do not assume foreign architecture packages are wrong; some applications require them.
next steps
Related commands
Find Broken or Leftover dpkg States
Not every package row is cleanly installed.
dpkg-query -W -f='${db:Status-Abbrev}\t${Package}\n' | awk '$1 !~ /^ii$/'
List Installed Package Versions
A package inventory beats memory when a server is drifting.
dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\n' | sort
Find the Largest Installed Packages
Disk cleanup starts with evidence, not random package removal.
dpkg-query -W -f='${Installed-Size}\t${Package}\n' | sort -nr | head -20
Check One Installed Package Cleanly
For one package, dpkg-query gives a clean status line.
dpkg-query -W -f='${Status} ${Version}\n' openssl
Find Which Package Owns a File
That binary came from somewhere. dpkg can tell you where.
dpkg-query -S /usr/sbin/nginx
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.