• 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 Examples in Linux

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.

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. nitrogen Command Examples in Linux
  2. gops Command Examples
  3. nsxiv Command Examples
  4. doctl auth: Authenticate doctl with one or more API tokens
  5. Linux OS Service ‘avahi-daemon’
  6. dotnet ef: Perform design-time development tasks for Entity Framework Core
  7. lpinfo Command Examples
  8. hydra Command Example
  9. How to Enable Password Aging in Linux with NIS
  10. bsdtar command – Read and write tape archive files

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