A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
-bash/zsh: namei command not found # Windows (WSL2) sudo apt-get update sudo apt-get install util-linux # Debian apt-get install util-linux # Ubuntu apt-get install util-linux # Alpine apk add util-linux # Arch Linux pacman -S util-linux # Kali Linux apt-get install util-linux # CentOS yum install util-linux # Fedora dnf install util-linux # OS X brew install util-linux # Raspbian apt-get install util-linux # Dockerfile dockerfile.run/namei # Docker docker run cmd.cat/namei namei
namei 将其参数解释为任何类型的 Unix 文件(符号链接、文件、目录等)的路径名。namei 随后跟踪每个路径名,直到找到端点(文件、目录、设备节点等)。如果找到符号链接,它会显示该链接,并开始跟踪它,缩进输出以显示上下文。
namei 程序可用于查找 符号链接层数过多 问题。
对于输出的每一行,namei 使用以下字符来标识找到的文件类型:
f: = 当前正在解析的路径名 d = 目录 l = 符号链接(输出链接及其内容) s = 套接字 b = 块设备 c = 字符设备 p = FIFO(命名管道) - = 常规文件 ? = 某种错误
当超出此系统可以拥有的最大符号链接数时,namei 会打印一条信息消息。
namei [options] pathname...
OPTIONS -l, --long Use the long listing format (same as -m -o -v). -m, --modes Show the mode bits of each file type in the style of ls(1), for example 'rwxr-xr-x'. -n, --nosymlinks Don’t follow symlinks. -o, --owners Show owner and group name of each file. -v, --vertical Vertically align the modes and owners. -x, --mountpoints Show mountpoint directories with a 'D' rather than a 'd'. -Z, --context Show security context of the file or "?" if not available. The support for security contexts is optional and does not have to be compiled to the namei binary. -h, --help Display help text and exit. -V, --version Print version and exit.
namei 解析作为参数指定的路径名:
namei path/to/a path/to/b path/to/c # sample: └─$ namei /Data/ f: /Data/ d / d Data
namei 以长列表格式显示结果:
namei --long path/to/a path/to/b path/to/c # sample --long └─$ namei --long /Data/output f: /Data/output drwxr-xr-x root root / drwxr-xr-x root root Data drwxrwxrwx root root output # 或者 -l └─$ namei -l /Data/output f: /Data/output drwxr-xr-x root root / drwxr-xr-x root root Data drwxrwxrwx root root output
namei 以 ls 样式显示每种文件类型的模式位,-m、--modes 显示每个文件的模式位:
namei --modes path/to/a path/to/b path/to/c # sample --modes └─$ namei --modes /Data/output f: /Data/output drwxr-xr-x / drwxr-xr-x Data drwxrwxrwx output # sample 或者简写 -m └─$ namei -m /Data/output f: /Data/output drwxr-xr-x / drwxr-xr-x Data drwxrwxrwx output
namei 显示每个文件的所有者和组名:
namei --owners path/to/a path/to/b path/to/c
namei 解析时不要跟踪符号链接 --nosymlinks:
namei --nosymlinks path/to/a path/to/b path/to/c