• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lsns: command not found

by Deepika

lsns is a Linux command that displays information about the namespaces in a Linux system. Namespaces are a feature of the Linux kernel that allow for the creation of isolated environments for processes. These environments can have their own set of system resources such as network interfaces, process IDs, mounts, and other system objects.

lsns provides information about all the namespaces present on the system or about a specific namespace specified with the -t option. This information can include the namespace ID, the type of namespace, and the PID of the process that created the namespace.

The output of lsns can be useful for troubleshooting and monitoring purposes. For example, you can use it to see the namespaces associated with a specific process or to find the type of namespace associated with a process. Additionally, lsns can be used to get a snapshot of the namespaces present on the system and their relationships with other namespaces and processes.

If you encounter the below error while running the command lsns:

lsns: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install util-linux
Ubuntu apt-get install util-linux
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install util-linux
CentOS yum install util-linux
Fedora dnf install util-linux
OS X brew install util-linux
Raspbian apt-get install util-linux

lsns Command Examples

1. List all namespaces:

# lsns

2. List namespaces in JSON format:

# lsns --json

3. List namespaces associated with {{pid}}:

# lsns --task pid

4. List the specified type of namespaces only:

# lsns --type 

5. List namespaces, only showing the namespace ID, type, PID, and command:

# lsns --output NS,TYPE,PID,COMMAND

Filed Under: Linux

Some more articles you might also be interested in …

  1. UNIX/Linux : Access control lists (ACLs) basics
  2. ltrace Command Examples in Linux
  3. How to mount an iso file in Linux
  4. xclip Command Examples in Linux
  5. How to Install ethtool software package in Debian
  6. slapt-get: command not found
  7. How to format code within web pages
  8. virt-xml-validate: command not found
  9. gist: Upload code to https://gist.github.com
  10. azurite: Azure Storage API compatible server (emulator) in local environment

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright