1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
'\" t
.\" Title: lsns
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.20
.\" Date: 2025-12-15
.\" Manual: System Administration
.\" Source: util-linux 2.41.3
.\" Language: English
.\"
.TH "LSNS" "8" "2025-12-15" "util\-linux 2.41.3" "System Administration"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
. mso www.tmac
. am URL
. ad l
. .
. am MTO
. ad l
. .
. LINKSTYLE blue R < >
.\}
.SH "NAME"
lsns \- list namespaces
.SH "SYNOPSIS"
.sp
\fBlsns\fP [options] [\fInamespace\fP]
.SH "DESCRIPTION"
.sp
\fBlsns\fP lists information about all the currently accessible namespaces or about the given \fInamespace\fP. The \fInamespace\fP identifier is an inode number.
.sp
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 (\fB\-\-tree\fP or \fB\-\-list\fP) and columns by using the \fB\-\-output\fP option together with a columns list in environments where a stable output is required.
.sp
The \fBNSFS\fP column, printed when \fBnet\fP is specified for the \fB\-\-type\fP option, is special; it uses multi\-line cells. Use the option \fB\-\-nowrap\fP to switch to ","\-separated single\-line representation.
.sp
Note that \fBlsns\fP reads information directly from the \fI/proc\fP filesystem and for non\-root users it may return incomplete information. The current \fI/proc\fP filesystem may be unshared and affected by a PID namespace (see \fBunshare \-\-mount\-proc\fP for more details). \fBlsns\fP is not able to see persistent namespaces without processes where the namespace instance is held by a bind mount to /proc/\fIpid\fP/ns/\fItype\fP.
.SH "OPTIONS"
.sp
\fB\-H\fP, \fB\-\-list\-columns\fP
.RS 4
List the available columns, use with \fB\-\-json\fP or \fB\-\-raw\fP to get output in machine\-readable format.
.RE
.sp
\fB\-J\fP, \fB\-\-json\fP
.RS 4
Use JSON output format.
.RE
.sp
\fB\-l\fP, \fB\-\-list\fP
.RS 4
Use list output format.
.RE
.sp
\fB\-n\fP, \fB\-\-noheadings\fP
.RS 4
Do not print a header line.
.RE
.sp
\fB\-o\fP, \fB\-\-output\fP \fIlist\fP
.RS 4
Specify which output columns to print. Use \fB\-\-help\fP to get a list of all supported columns.
.sp
The default list of columns may be extended if \fIlist\fP is specified in the format \fB+\fP\fIlist\fP (e.g., \fBlsns \-o +PATH\fP).
.RE
.sp
\fB\-\-output\-all\fP
.RS 4
Output all available columns.
.RE
.sp
\fB\-P\fP, \fB\-\-persistent\fP
.RS 4
Display only the namespaces without processes (aka persistent namespaces), created by bind mounting
/proc/pid/ns/type files to a filesystem path.
.RE
.sp
\fB\-p\fP, \fB\-\-task\fP \fIPID\fP
.RS 4
Display only the namespaces held by the process with this \fIPID\fP.
.RE
.sp
\fB\-Q\fP, \fB\-\-filter\fP \fIexpr\fP
.RS 4
Print only the namespaces that meet the conditions specified by the expr.
.sp
This feature is EXPERIMENTAL. See also \fBscols\-filter\fP(5). For example
exclude root as username, but print every namespaces more than one process
belongs to:
.RE
.RS 3
.ll -.6i
.sp
.if n .RS 4
.nf
.fam C
lsns \-\-filter \*(AqUSER != "root" and NPROCS > 1\*(Aq
.fam
.fi
.if n .RE
.br
.RE
.ll
.sp
\fB\-r\fP, \fB\-\-raw\fP
.RS 4
Use the raw output format.
.RE
.sp
\fB\-t\fP, \fB\-\-type\fP \fItype\fP
.RS 4
Display the specified \fItype\fP of namespaces only. The supported types are \fBmnt\fP, \fBnet\fP, \fBipc\fP, \fBuser\fP, \fBpid\fP, \fButs\fP, \fBcgroup\fP and \fBtime\fP. This option may be given more than once.
.RE
.sp
\fB\-u\fP, \fB\-\-notruncate\fP
.RS 4
Do not truncate text in columns.
.RE
.sp
\fB\-W\fP, \fB\-\-nowrap\fP
.RS 4
Do not use multi\-line text in columns.
.RE
.sp
\fB\-T\fP, \fB\-\-tree\fP[\fB=\fP\fIrel\fP]
.RS 4
Use tree\-like output format. If \fBprocess\fP is given as \fIrel\fP, print process tree(s) in each name space. This is default when \fB\-\-tree\fP is not specified. If \fBparent\fP is given, print tree(s) constructed by the parent/child relationship. If \fBowner\fP is given, print tree(s) constructed by the owner/owned relationship. \fBowner\fP is used as default when \fIrel\fP is omitted.
.RE
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
Display help text and exit.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Display version and exit.
.RE
.SH "EXIT STATUS"
.sp
The \fBlsns\fP utility exits with one of the following values:
.sp
\fB0\fP
.RS 4
Success.
.RE
.sp
\fB1\fP
.RS 4
General error.
.RE
.sp
\fB2\fP
.RS 4
An ioctl was unknown to the kernel.
.RE
.SH "ENVIRONMENT"
.sp
\fBLSNS_DEBUG\fP=all
.RS 4
enables \fBlsns\fP debug output.
.RE
.SH "AUTHORS"
.sp
.MTO "kzak\(atredhat.com" "Karel Zak" ""
.SH "SEE ALSO"
.sp
\fBnsenter\fP(1),
\fBunshare\fP(1),
\fBclone\fP(2),
\fBnamespaces\fP(7),
\fBioctl_ns\fP(2),
\fBip\-netns\fP(8)
\fBscols\-filter\fP(5)
.SH "REPORTING BUGS"
.sp
For bug reports, use the \c
.URL "https://github.com/util\-linux/util\-linux/issues" "issue tracker" "."
.SH "AVAILABILITY"
.sp
The \fBlsns\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."
|