namei Command Examples in Linux

“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.

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