Spotting where your process hides with lsns
Container Basics On Linux (Namespaces/Cgroups)
Spotting where your process hides with lsns
🧩 The Challenge
Trying to figure out why a process inside a container can’t see the host’s network interfaces has driven me up the wall more than once. You start hunting through /proc and get lost in the noise, which is just a total waste of a perfectly good afternoon.
💡 The Fix
Use lsns to list every namespace currently active on your system so you can see if your container is actually joined to the right one. It saves you from guessing which PID belongs to which isolation bucket.
lsns -p <PID>
⚙️ Why It Works
This utility digs straight into the kernel’s namespace tracking for that specific process ID and prints out the types and identifiers for every namespace it’s currently using. It beats manually crawling through /proc/[pid]/ns/ directories by a mile.
🚀 Pro-Tip: Pipe the output to column -t if you’re dealing with a cluttered system to actually keep the output readable.
Linux Tips & Tricks | © ngelinux.com | 7/12/2026
