Sobes.tech
Junior — Middle

How can you list available namespaces on a Linux system via command line?

sobes.tech AI

Answer from AI

In Linux, to view available namespaces, you can use the lsns command. It displays a list of all existing namespaces in the system, with information about their type, ID, and associated processes.

Example usage:

lsns

If the lsns command is not available, you can look into the contents of the /proc/[pid]/ns/ directory for a specific process, for example:

ls -l /proc/1/ns/

This will show links to the namespaces associated with the process with PID 1.