lsns
根据运行它的用户的权限,输出看起来会有所不同。ubuntu
用户和root
用户得到不同的结果:
ubuntu@ubuntu:~$ lsns
NS TYPE NPROCS PID USER COMMAND
4026531834 time 6 134628 ubuntu /lib/systemd/systemd --user
4026531835 cgroup 6 134628 ubuntu /lib/systemd/systemd --user
4026531836 pid 6 134628 ubuntu /lib/systemd/systemd --user
4026531837 user 5 134628 ubuntu /lib/systemd/systemd --user
4026531838 uts 6 134628 ubuntu /lib/systemd/systemd --user
4026531839 ipc 6 134628 ubuntu /lib/systemd/systemd --user
4026531840 net 6 134628 ubuntu /lib/systemd/systemd --user
4026531841 mnt 5 134628 ubuntu /lib/systemd/systemd --user
4026532290 user 1 134689 ubuntu /usr/bin/podman
4026532291 mnt 1 134689 ubuntu /usr/bin/podman
ubuntu@ubuntu:~$
ubuntu@ubuntu:~$
ubuntu@ubuntu:~$ sudo lsns
NS TYPE NPROCS PID USER COMMAND
4026531834 time 115 1 root /sbin/init
4026531835 cgroup 115 1 root /sbin/init
4026531836 pid 112 1 root /sbin/init
4026531837 user 113 1 root /sbin/init
4026531838 uts 112 1 root /sbin/init
4026531839 ipc 115 1 root /sbin/init
4026531840 net 115 1 root /sbin/init
4026531841 mnt 101 1 root /sbin/init
4026531862 mnt 1 25 root kdevtmpfs
4026532284 mnt 1 414 root /lib/systemd/systemd-udevd
4026532285 uts 1 414 root /lib/systemd/systemd-udevd
4026532286 mnt 1 469 systemd-timesync /lib/systemd/systemd-timesyncd
4026532287 uts 1 469 systemd-timesync /lib/systemd/systemd-timesyncd
4026532288 mnt 1 572 systemd-network /lib/systemd/systemd-networkd
4026532289 mnt 1 608 systemd-resolve /lib/systemd/systemd-resolved
4026532290 user 1 134689 ubuntu /usr/bin/podman
4026532291 mnt 1 134689 ubuntu /usr/bin/podman
4026532292 mnt 1 5369 root /usr/libexec/upowerd
4026532293 user 1 5369 root /usr/libexec/upowerd
4026532295 mnt 2 134974 root unshare --fork --pid --mount-proc /bin/bash
4026532296 pid 2 134975 root /bin/bash
4026532297 mnt 2 134981 root unshare --fork --pid --mount-proc /bin/zsh
4026532298 pid 1 134982 root /bin/zsh
4026532345 uts 1 655 root /lib/systemd/systemd-logind
4026532346 mnt 1 631 root /usr/sbin/irqbalance --foreground
4026532347 mnt 1 655 root /lib/systemd/systemd-logind
4026532348 mnt 1 678 root /usr/sbin/ModemManager
ubuntu@ubuntu:~$
此外,Ubuntu 系统的 init 进程名称不同:systemd
vs /sbin/init
。这是什么原因?谢谢。