LSNS(8) System Administration LSNS(8)

# [NAME](#NAME)

lsns - list namespaces

# [SYNOPSIS](#SYNOPSIS)

**lsns** \[options] \[*namespace ID*]

# [DESCRIPTION](#DESCRIPTION)

**lsns** lists information about all the currently accessible namespaces or about the given *namespace*. The *namespace* identifier is an inode number.

The default output is subject to change. So whenever possible, you should avoid using default outputs in your scripts. Always explicitly define expected output mode (**--tree** or **--list**) and columns by using the **--output** option together with a columns list in environments where a stable output is required.

The **NSFS** column, printed when **net** is specified for the **--type** option, is special; it uses multi-line cells. Use the option **--nowrap** to switch to ","-separated single-line representation.

Note that **lsns** reads information directly from the */proc* filesystem and for non-root users it may return incomplete information. The current */proc* filesystem may be unshared and affected by a PID namespace (see **unshare --mount-proc** for more details). **lsns** is not able to see persistent namespaces without processes where the namespace instance is held by a bind mount to /proc/*pid*/ns/*type*.

# [OPTIONS](#OPTIONS)

**-H**, **--list-columns**

List the columns that can be specified with the **--output** option. Can be used with **--json** or **--raw** to get the list in a machine-readable format.

**-J**, **--json**

Use JSON output format.

**-l**, **--list**

Use list output format.

**-n**, **--noheadings**

Do not print a header line.

**-o**, **--output** *list*

Specify which output columns to print. Use **--help** to get a list of all supported columns.

The default list of columns may be extended if *list* is specified in the format **+list** (e.g., **lsns -o +PATH**).

**--output-all**

Output all available columns.

**-P**, **--persistent**

Display only the namespaces without processes (aka persistent namespaces), created by bind mounting /proc/pid/ns/type files to a filesystem path.

**-p**, **--task** *PID*

Display only the namespaces held by the process with this *PID*.

**-Q**, **--filter** *expr*

Print only the namespaces that meet the conditions specified by the expr.

This feature is EXPERIMENTAL. See also [**scols-filter**(5)](/man/os/util-linux/scols-filter.5). For example exclude root as username, but print every namespaces more than one process belongs to:

```
lsns --filter 'USER != "root" and NPROCS > 1'
```

**-r**, **--raw**

Use the raw output format.

**-t**, **--type** *type*

Display the specified *type* of namespaces only. The supported types are **mnt**, **net**, **ipc**, **user**, **pid**, **uts**, **cgroup** and **time**. This option may be given more than once.

**-u**, **--notruncate**

Do not truncate text in columns.

**-W**, **--nowrap**

Do not use multi-line text in columns.

**-T**, **--tree**\[**=rel**]

Use tree-like output format. If **process** is given as *rel*, print process tree(s) in each name space. This is default when **--tree** is not specified. If **parent** is given, print tree(s) constructed by the parent/child relationship. If **owner** is given, print tree(s) constructed by the owner/owned relationship. **owner** is used as default when *rel* is omitted.

**-h**, **--help**

Display help text and exit.

**-V**, **--version**

Display version and exit.

# [EXIT STATUS](#EXIT_STATUS)

The **lsns** utility exits with one of the following values:

**0**

Success.

**1**

General error.

**2**

An ioctl was unknown to the kernel.

# [ENVIRONMENT](#ENVIRONMENT)

**LSNS\_DEBUG**=all

enables **lsns** debug output.

**LIBSMARTCOLS\_DEBUG**=all

enables libsmartcols debug output.

**LIBSMARTCOLS\_DEBUG\_PADDING**=on

use visible padding characters.

**LIBSMARTCOLS\_JSON**=compact|lines

Controls JSON output format when using **--json**. Supported values are **compact** for JSON output with minimal whitespace, and **lines** for JSON Lines format (one JSON object per line). If unset or set to any other value, pretty-printed JSON is used.

# [AUTHORS](#AUTHORS)

*Karel Zak* &lt;kzak@redhat.com&gt;

# [SEE ALSO](#SEE_ALSO)

[**nsenter**(1)](/man/os/util-linux/nsenter.1), [**unshare**(1)](/man/os/util-linux/unshare.1), [**clone**(2)](/man/os/util-linux/clone.2), [**namespaces**(7)](/man/os/util-linux/namespaces.7), [**ioctl\_ns**(2)](/man/os/util-linux/ioctl_ns.2), [**ip-netns**(8)](/man/os/util-linux/ip-netns.8), [**scols-filter**(5)](/man/os/util-linux/scols-filter.5)

# [REPORTING BUGS](#REPORTING_BUGS)

For bug reports, use the *issue tracker* &lt;https://github.com/util-linux/util-linux/issues&gt;.

# [AVAILABILITY](#AVAILABILITY)

The **lsns** command is part of the util-linux package which can be downloaded from *Linux Kernel Archive* &lt;https://www.kernel.org/pub/linux/utils/util-linux/&gt;.

2026-10-19 util-linux 2.42.4

---

Document: lsns(8) from util-linux 2.42.4-r1 (Chainguard OS)
