Stop looking for process PIDs in the wrong root namespace
Container Basics On Linux (Namespaces/Cgroups)
Stop looking for process PIDs in the wrong root namespace
🧩 The Challenge
Trying to hunt down a container process from the host is a nightmare when the PIDs don’t match up. You run ps aux and get totally different numbers than what your container runtime says.
💡 The Fix
Use the unshare command with the right flags to inspect the process from the correct mount and PID namespace perspective without actually entering the container. It’s way cleaner than blindly grepping through everything.
nsenter -t <PID> -p -m ps aux
⚙️ Why It Works
By targeting the specific PID’s namespace, you effectively shim your vision into the container’s isolated view of the process table and filesystem. It keeps you on the host side while seeing exactly what that container sees.
🚀 Pro-Tip: Alias this to something like ‘nps’ so you don’t have to remember which flags to tack on every single time.
Linux Tips & Tricks | © ngelinux.com | 9/10/2026
