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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. btrbk Command Examples in Linux
  2. CentOS / RHEL : How to rotate /var/log/wtmp and /var/log/btmp file using logrotate
  3. deluser Command Examples in Linux
  4. How to uninstall fail2ban on Ubuntu
  5. blkdiscard: command not found
  6. How to Create a New /boot Partition in CentOS / RHEL
  7. CentOS / RHEL 7 : How to set udev rules for ASM on multipath disks
  8. How to fix the error “host key verification failed”
  9. How to Configure Device File owner/group with udev rules
  10. pacman4console: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright