lsns
List Linux namespaces
TLDR
List all namespaces
List namespaces in JSON format
List namespaces associated with the specified process
List the specified type of namespaces only
List namespaces, only showing the namespace ID, type, PID, and command
SYNOPSIS
lsns [options]
PARAMETERS
-a
List all block devices.-b
List devices in byte sizes.-d
List only block devices, not partitions.-i
List device topology in inodes (only available for sysfs-based setups).-l
Long listing format.-n
List devices by name only.-o
columns
Specify columns to display. Comma separated list (e.g. NAME,MAJ:MIN). Use lsns -o HELP
to see available columns.-p
List partitions.-S
sort
Sort output by specified columns. Use lsns -S HELP
to see available columns.-t
Display device topology.-V
Display version information.-h
Display help message.--bytes
Print SIZE in bytes rather than in human-readable format.--fs
List filesystem related information.--sysroot
directory
Prefix all device paths with the specified directory
.[device]
Specify a device to list.
DESCRIPTION
The lsns
command lists the block devices available on the system, presenting information about their hierarchy and topology. This is useful for understanding how storage devices are connected and configured. The command can display detailed information about devices, partitions, logical volumes, and other related entities. It provides a structured output showing the relationships between these components. The tool helps in troubleshooting storage issues, identifying device paths, and managing storage resources. The output can be filtered and customized to show specific device types or attributes.lsns
is part of the util-linux
package, which is essential for basic system administration. It reads information from the kernel and device files under /dev
and /sys
to build its output. The output can be formatted in different ways to improve readability and suitability for scripting.
DEVICE IDENTIFICATION
lsns
relies on information provided by the kernel and device files. The output can be affected by device drivers and udev rules.
SCRIPTING
The -o
option is particularly useful for scripting, as it allows you to select specific columns and generate output in a format suitable for parsing.
HISTORY
lsns
is part of the util-linux
package, which has been under continuous development for a long time. The command was created to provide a more structured and informative way to list block devices compared to traditional tools. Over time, it has been enhanced with new features and options to support modern storage technologies and system configurations.
The usage of lsns
has increased as systems become more complex and require better tools for managing storage resources. Its clear output and filtering capabilities make it a valuable tool for system administrators and developers.