namei: command not found

“namei” is a Unix command-line utility that is used to display the pathnames of files or directories and the associated metadata (permissions, owner, etc.). It also resolves symbolic links, meaning that it follows the chain of symbolic links until it reaches the final file or directory in the path. This is particularly useful for debugging “too many levels of symbolic links” errors, where a symbolic link refers to another symbolic link in a recursive manner, resulting in an infinite loop. By using “namei”, you can trace the path of symbolic links to the final target and identify where the loop is occurring. In this way, “namei” helps you to diagnose and resolve these types of issues.

If you encounter the below error while running the command namei:

namei: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
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

namei Command Examples

1. Resolve the pathnames specified as the argument parameters:

# namei path/to/a path/to/b path/to/c

2. Display the results in a long-listing format:

# namei --long path/to/a path/to/b path/to/c

3. Show the mode bits of each file type in the style of `ls`:

# namei --modes path/to/a path/to/b path/to/c

4. Show owner and group name of each file:

# namei --owners path/to/a path/to/b path/to/c

5. Don’t follow symlinks while resolving:

# namei --nosymlinks path/to/a path/to/b path/to/c
Related Post