← 返回命令列表

Linux command

namespaces 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

List all namespaces

lsns

Enter namespace of process

nsenter -t [PID] -a

Create new mount namespace

unshare --mount [command]

Create new network namespace

ip netns add [name]

Run in new user namespace

unshare --user --map-root-user [command]

说明

Namespaces are a Linux kernel feature that wraps global system resources in an abstraction layer, making it appear to processes within a namespace that they have their own isolated instance of the resource. They are fundamental to container technologies like Docker and LXC. Each namespace type isolates a different aspect of the system.

FAQ

What is the namespaces command used for?

Namespaces are a Linux kernel feature that wraps global system resources in an abstraction layer, making it appear to processes within a namespace that they have their own isolated instance of the resource. They are fundamental to container technologies like Docker and LXC. Each namespace type isolates a different aspect of the system.

How do I run a basic namespaces example?

Run `lsns` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

Where can I find more namespaces examples?

This page includes 5 examples for namespaces, plus related commands for nearby Linux tasks.