lsns: show active Linux namespaces
Shows used namespaces
Typical usage: information gathering, system administration, troubleshootingIntroduction 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.
Column | Description |
---|---|
COMMAND | Command line of the PID |
NPROCS | Number of processes inside the namespace |
NETNSID | Namespace ID for network subsystem |
NS | Namespace identifier by inode number |
NSFS | Mountpoint of nsfs virtual filesystem |
ONS | Owner namespace identifier (inode number) |
PATH | Path to the namespace |
PID | Lowest process ID within the namespace |
PNS | Parent namespace identifier (inode number) |
PPID | Parent process ID (PPID) of the proces ID (PID) |
TYPE | Namespace type (cgroup, ipc, mnt, net, pid, time, user, uts) |
UID | User ID of the PID |
USER | Username of the PID |
Project details
Background information | |
---|---|
Authors | Karel Zak |
Initial commit | 2015-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 system | Package name | Installation |
---|---|---|
AlmaLinux | util-linux |
|
Arch Linux | util-linux |
|
Debian | util-linux |
|
Fedora | util-linux |
|
Red Hat Enterprise Linux | util-linux |
|
Rocky Linux | util-linux |
|
openSUSE | util-linux |
|
Ubuntu | util-linux |
|
Your Linux distribution using a different package? Share your feedback.
Usage
Available options
Long option | Short option | Description |
---|---|---|
--json | -J | Provide 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:
Command | Category | Summary |
---|---|---|
capsh | capabilities | Linux capabilities testing and debugging tool |
captest | capabilities | Capabilities and privilege escalation testing tool |
chrt | processes | Sets Linux scheduler policy and priority for a process or command |
dmesg | logging | Shows kernel log messages |
filecap | capabilities | Display of Linux capabilities set on binaries in paths |
firejail | sandboxing | Sandboxing tool for Linux |
getcap | capabilities | Show file capabilities |
getpcaps | capabilities | Show process capabilities |
lsusb | capabilities | Show USB devices |
netcap | capabilities | Display available capabilities for running processes using network sockets |
pscap | capabilities | Display available capabilities for running processes |
setcap | capabilities | Add or remove Linux capabilities to a file |
slabtop | memory | Shows slab usage of kernel |
uname | system information | Shows basic system information |