LSNS(8)
โจ LSNS(8) โจ
okay bestie, so you wanna know about lsns? it's a sysadmin girly from the util-linux family and she's literally the namespace gossip of the whole system ๐
๐ธ NAME ๐ธ
lsns โ list namespaces ๐ซถ
๐ SYNOPSIS ๐
lsns [options] [namespace ID]
๐ฆ DESCRIPTION ๐ฆ
so what does she DO. lsns lists info about all the currently accessible namespaces, or about the one specific namespace you hand her. and the namespace identifier? that's an inode number, no cap.
๐จ okay this part matters, listen up: the default output is subject to change. so whenever you possibly can, do NOT be using default outputs in your scripts. like, ever. always explicitly define the expected output mode (--treeor--list) and the columns by using the--outputoption together with a columns list in any environment where you need stable output. periodt. ๐ฅ
the NSFS column โ the one that gets printed when net is specified for the --type option โ is special, she's extra ๐
she uses multi-line cells. wanna switch to a ,-separated single-line representation instead? use the --nowrap option. easy.
and now the lil warning tea โ: note that lsns reads information directly from the /proc filesystem, and for non-root users it may return incomplete information. also the current /proc filesystem may be unshared and affected by a PID namespace (go peek at unshare --mount-proc for more deets). and 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. tragic, i know ๐ญ
๐ OPTIONS ๐
-H,--list-columnsโ list all the columns you can specify with the--outputoption. can also be used with--jsonor--rawto get that list in a machine-readable format ๐ค-J,--jsonโ use the JSON output format โจ-l,--listโ use the list output format ๐-n,--noheadingsโ do not print a header line, we're going headless bestie-o,--outputlist โ specify which output columns to print. use--helpto 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. all of them. every single one. greedy girly energy ๐-P,--persistentโ display only the namespaces without processes (aka persistent namespaces), created by bind mounting/proc/pid/ns/typefiles to a filesystem path ๐ง-p,--taskPID โ display only the namespaces held by the process with this PID ๐-Q,--filterexpr โ print only the namespaces that meet the conditions specified by the expr.
โ ๏ธ this feature is EXPERIMENTAL. also see scols-filter(5). for example, exclude root as username but print every namespace that more than one process belongs to:
lsns --filter 'USER != "root" and NPROCS > 1'
-r,--rawโ use the raw output format ๐ฅฉ-t,--typetype โ display only the specified type of namespaces. the supported types aremnt,net,ipc,user,pid,uts,cgroupandtime. this option may be given more than once ๐-u,--notruncateโ do not truncate text in columns. let her breathe, let her be long ๐-W,--nowrapโ do not use multi-line text in columns ๐ซ-T,--tree[=rel]โ use tree-like output format. ifprocessis given as rel, print process tree(s) in each namespace. this is default when--treeis not specified. ifparentis given, print tree(s) constructed by the parent/child relationship. ifowneris given, print tree(s) constructed by the owner/owned relationship.owneris used as default when rel is omitted ๐ณ-h,--helpโ display help text and exit ๐-V,--versionโ display version and exit ๐ท๏ธ
๐ EXIT STATUS ๐
the lsns utility exits with one of these values, and yes each one has a vibe:
0โ success. slay ๐1โ general error ๐ญ2โ an ioctl was unknown to the kernel ๐
โญ ENVIRONMENT โญ
LSNS_DEBUG=allโ enableslsnsdebug 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 arecompactfor JSON output with minimal whitespace, andlinesfor JSON Lines format (one JSON object per line). if unset or set to any other value, pretty-printed JSON is used โจ
๐ซถ AUTHORS ๐ซถ
Karel Zak <kzak@redhat.com> โ icon, legend, the moment ๐
๐ SEE ALSO ๐
nsenter(1), unshare(1), clone(2), namespaces(7), ioctl_ns(2), ip-netns(8), scols-filter(5)
๐ REPORTING BUGS ๐
for bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>. go tell them, they wanna know ๐ซ
๐ฆ AVAILABILITY ๐ฆ
the lsns command is part of the util-linux package, which can be downloaded from the Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/> ๐พ
okay that's the whole page bestie!! this is util-linux 2.42.4, dated 2026-09-21 โ go be the main character of your own process tree ๐ณ๐ mwah, bye!!
๐ฆ where this page comes from
- arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms