lsns(1)
List all namespaces on the system with their type, PID, and parent namespace information.
Synopsis
lsns [OPTION]... [NAMESPACE]Description
The lsns command displays information about all namespaces currently on the system. Namespaces are a Linux kernel feature that isolate system resources (network, mount, PID, user, IPC, UTS, cgroup). This tool is useful for understanding container and process isolation.
By default, lsns shows all namespace types. You can filter by specific namespace type (e.g., net, pid, mnt) or display only namespaces used by a particular process. Output includes namespace ID, type, parent namespace, owner UID, and leading process PID.
Common options
| Flag | What it does |
|---|---|
-t, --type=TYPE | List only namespaces of specified type (e.g., net, pid, mnt, uts, ipc, user, cgroup) |
-p, --pid=PID | Display namespaces used by the specified process |
-n, --noheadings | Omit column headers from output |
-o, --output=LIST | Define which columns to display (e.g., NS,TYPE,NPROCS,PID,COMMAND) |
-r, --raw | Output in raw mode, suitable for parsing by scripts |
-u, --uid | Display the namespace owner's UID |
-l, --list | Use list output format |
-h, --help | Display help message and exit |
-V, --version | Display version information and exit |
Examples
Display all namespaces on the system with default columns
lsnsList only network namespaces, useful for checking container networking setup
lsns -t netShow all namespaces used by process with PID 1234
lsns -p 1234Display PID namespaces with selected columns: namespace ID, process count, and leading command
lsns -t pid -o NS,NPROCS,COMMANDList mount namespaces without header row for script processing
lsns -t mnt -nShow user namespaces along with their owner UID
lsns -t user -uDisplay first 10 namespaces in raw format for scripting
lsns -r | head -10