lsns: show active Linux namespaces

Shows used namespaces

Typical usage: information gathering, system administration, troubleshooting

Introduction into lsns

The lsns command is used for showing information about Linux namespaces. It is part of the util-linux package, which comes with many tools related to system administration. By just running the command most details are already presented. It is a good way to learn what processes are using a different namespace than the global ones.

Used columns

The command uses several columns to display the information. These are the columns and a description of what information it represents.

ColumnDescription
COMMANDCommand line of the PID
NPROCSNumber of processes inside the namespace
NETNSIDNamespace ID for network subsystem
NSNamespace identifier by inode number
NSFSMountpoint of nsfs virtual filesystem
ONSOwner namespace identifier (inode number)
PATHPath to the namespace
PIDLowest process ID within the namespace
PNSParent namespace identifier (inode number)
PPIDParent process ID (PPID) of the proces ID (PID)
TYPENamespace type (cgroup, ipc, mnt, net, pid, time, user, uts)
UIDUser ID of the PID
USERUsername of the PID

Project details

Background information about the lsns command.
Background information
AuthorsKarel Zak
Initial commit2015-11-26

Installation

When lsns is not installed by default, it can be added to the system using the relevant software package.

Package information for lsns

Operating systemPackage nameInstallation
AlmaLinuxutil-linux
dnf install util-linux
Arch Linuxutil-linux
pacman -S util-linux
Debianutil-linux
apt install util-linux
Fedorautil-linux
dnf install util-linux
Red Hat Enterprise Linuxutil-linux
dnf install util-linux
Rocky Linuxutil-linux
dnf install util-linux
openSUSEutil-linux
zypper install util-linux
Ubuntuutil-linux
apt install util-linux

Your Linux distribution using a different package? Share your feedback.

Usage

Available options

Long optionShort optionDescription
--json-JProvide output as JSON

Missing an option in this overview? Share your feedback.

Examples using lsns

Show all available namespaces

lsns

Frequently Asked Questions

What is the lsns command and its purpose?

The lsns command is a command-line tool on Linux to the namespaces that are in use.

Which package provides the lsns command?

The command lsns is provided by the util-linux package.

Related and similar commands

Linux has a lot of tools and commands available and sometimes you just need that little other tool. Here is a list of commands that are similar or related to lsns:

Related and similar commands to lsns
CommandCategorySummary
capshcapabilitiesLinux capabilities testing and debugging tool
captestcapabilitiesCapabilities and privilege escalation testing tool
chrtprocessesSets Linux scheduler policy and priority for a process or command
dmesgloggingShows kernel log messages
filecapcapabilitiesDisplay of Linux capabilities set on binaries in paths
firejailsandboxingSandboxing tool for Linux
getcapcapabilitiesShow file capabilities
getpcapscapabilitiesShow process capabilities
lsusbcapabilitiesShow USB devices
netcapcapabilitiesDisplay available capabilities for running processes using network sockets
pscapcapabilitiesDisplay available capabilities for running processes
setcapcapabilitiesAdd or remove Linux capabilities to a file
slabtopmemoryShows slab usage of kernel
unamesystem informationShows basic system information