Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any method in Linux to list all namespaces on the running host? I need to check namespaces for particular processes (e.g. processes running in LXC-container and all other processes on the host) and then find out cgroups of them.

share|improve this question

migrated from serverfault.com Dec 16 '13 at 16:41

This question came from our site for system and network administrators.

From ip man page for network name space

ip netns - process network namespace management A network namespace is logically another copy of the network stack, with it's own routes, firewall rules, and network devices.

   By  convention  a   named   network   namespace   is   an   object   at
   /var/run/netns/NAME  that can be opened.  The file descriptor resulting
   from opening /var/run/netns/NAME refers to the specified network names-
   pace.   Holding  that  file descriptor open keeps the network namespace
   alive.  The file descriptor can be used with the setns(2)  system  call
   to change the network namespace associated with a task.

   The  convention for network namespace aware applications is to look for
   global network configuration files first in  /etc/netns/NAME/  then  in
   /etc/.    For   example,   if   you   want   a   different  version  of
   /etc/resolv.conf for a network namespace used to isolate your  vpn  you
   would name it /etc/netns/myvpn/resolv.conf.

For name spaces of other types, maybe there is other ways

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.