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 (--tree or --list) and the columns by using the --output option 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 --output option. can also be used with --json or --raw to 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, --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. 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/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. 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, --type type โ€” display only the specified type of namespaces. 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. 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. if process is given as rel, print process tree(s) in each namespace. 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 ๐ŸŒˆ

the lsns utility exits with one of these values, and yes each one has a vibe:

  1. 0 โ€” success. slay ๐ŸŽ‰
  2. 1 โ€” general error ๐Ÿ˜ญ
  3. 2 โ€” an ioctl was unknown to the kernel ๐Ÿ’€

โญ 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 ๐Ÿซถ

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